Skip to content

GH-233 Add option to disable pings for users#233

Open
CitralFlo wants to merge 2 commits intomasterfrom
disable-pings
Open

GH-233 Add option to disable pings for users#233
CitralFlo wants to merge 2 commits intomasterfrom
disable-pings

Conversation

@CitralFlo
Copy link
Member

Option should remove pings from DM and Server messages.
Some users want to take a break from reviews - ex. due to Matura exams.

@CitralFlo CitralFlo changed the title Add option to disable pings for users GH-233 Add option to disable pings for users Feb 1, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 Notification Type: Introduced a new NONE constant to the GitHubReviewNotificationType enum, allowing users to completely disable review pings.
  • Notification Logic Update: The isDmNotify() and isServerNotify() methods in GitHubReviewNotificationType were updated to correctly return false when the notification type is NONE, ensuring no pings are sent.
  • Command Option Added: The notification command (NotificationChild.java) now includes NONE as a selectable option, enabling users to configure this new setting.
  • Reminder Service Refactoring: Removed the direct user retrieval and reminder message sending logic from GitHubReviewReminderService.java, indicating a refactoring of how review reminders are dispatched.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

critical

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants