GH-233 Add option to disable pings for users#233
Conversation
Summary of ChangesHello @CitralFlo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a user-requested feature to allow individuals to opt out of all review pings, providing greater control over their notification experience. By introducing a 'NONE' option for notification preferences, users can now effectively pause incoming review reminders without disabling other essential notifications. This change enhances user flexibility and supports periods where users may need to temporarily disengage from review notifications. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces an option for users to disable notifications for review assignments by adding a NONE notification type. The changes correctly update the command to select this option and the logic for sending initial notifications in GitHubReviewService.
However, a critical issue has been introduced in GitHubReviewReminderService. The implementation completely removes the functionality for sending review reminders for all users, rather than just for those who have opted out. This seems to be a misinterpretation of the requirements. The reminder service is now broken, as it continues to run and perform checks without ever sending any reminders. My review includes a detailed comment on how to fix this by restoring the reminder logic and making it respect the user's notification preferences.
I am having trouble creating individual review comments. Click here to see my feedback.
src/main/java/com/eternalcode/discordapp/review/GitHubReviewReminderService.java (199-209)
Removing this block of code, along with the handleUserRetrieved and sendReminderMessage methods, completely disables the review reminder functionality for all users. The pull request's goal is to allow users to opt-out of notifications, not to remove reminders entirely. The reminder service will continue to run and consume resources checking for reminders, but it will never send one.
This functionality should be preserved, but it should respect the user's notification settings. I suggest restoring the deleted code and adding a check for the user's notification preference before sending a reminder.
You could add a method to get the user's review settings:
private GitHubReviewUser findReviewUserByDiscordId(long userId) {
return this.appConfig.reviewSystem.reviewers.stream()
.filter(user -> user.getDiscordId() != null && user.getDiscordId() == userId)
.findFirst()
.orElse(null);
}And then use it in handlePRStatusCheck:
// ... after checking if user has already reviewed
GitHubReviewUser reviewUser = this.findReviewUserByDiscordId(reminder.userId());
if (reviewUser != null && reviewUser.getNotificationType() == GitHubReviewNotificationType.NONE) {
LOGGER.info("User " + githubUsername + " has reminders disabled, skipping reminder.");
return;
}
// The original code to send a reminder
this.jda.retrieveUserById(reminder.userId()).queue(
user -> this.handleUserRetrieved(
user,
reminder.threadId(),
reminder.pullRequestUrl(),
pullRequest),
throwable -> {
Sentry.captureException(throwable);
LOGGER.log(Level.SEVERE, "Error retrieving user: " + reminder.userId(), throwable);
}
);You would also need to restore the handleUserRetrieved and sendReminderMessage methods that were removed from this file.
Option should remove pings from DM and Server messages.
Some users want to take a break from reviews - ex. due to Matura exams.