Skip to content

Feature/disable email notifications #903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Eshwar1212-maker
Copy link

@Eshwar1212-maker Eshwar1212-maker commented Jul 29, 2025

What kind of change does this PR introduce?

Feature — Adds email notification toggling for users in the Settings UI to opt out of emails. This connects the existing backend logic (sendEmailToOrg) to the frontend with a working Button component.

eg: Bug fix, feature, docs update, ...

Why was this change needed?

This is an active issue requested by a user, I will link it here:
#163

Other information:

I wanted to open a new request in the 'community support tickets' page on discord but currently don't have any permission.

Checklist:

Put a "X" in the boxes below to indicate you have followed the checklist;

  • I have read the CONTRIBUTING guide.
  • I checked that there were not similar issues or PRs already open for this.
  • This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.
Screen.Recording.2025-07-29.at.6.34.31.PM.mov
Screenshot 2025-07-29 at 6 44 05 PM

Copy link

vercel bot commented Jul 29, 2025

@Eshwar1212-maker is attempting to deploy a commit to the Listinai Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

coderabbitai bot commented Jul 29, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@egelhaus egelhaus requested a review from Copilot July 29, 2025 23:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability for users to toggle email notifications on and off through the Settings UI. It extends the existing backend email notification infrastructure by connecting it to a new frontend component that allows users to control their email preferences.

Key Changes

  • Added emailNotifications field to the User model in the database schema with a default value of true
  • Updated the email sending logic to respect user preferences before sending notifications
  • Created a new Settings UI component for managing email notification preferences

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libraries/nestjs-libraries/src/database/prisma/schema.prisma Added emailNotifications boolean field to User model
libraries/nestjs-libraries/src/database/prisma/users/users.service.ts Added service methods for getting/updating email notification preferences
libraries/nestjs-libraries/src/database/prisma/users/users.repository.ts Added repository methods for email notification database operations
libraries/nestjs-libraries/src/database/prisma/organizations/organization.repository.ts Updated query to include emailNotifications field when fetching user data
libraries/nestjs-libraries/src/database/prisma/notifications/notification.service.ts Updated email sending logic to check user preferences before sending
apps/backend/src/api/routes/settings.controller.ts Added API endpoints for getting and updating email notification preferences
apps/frontend/src/components/settings/email.notifications.component.tsx New React component for email notification settings UI
apps/frontend/src/components/layout/settings.component.tsx Integrated email notifications component into settings layout
Comments suppressed due to low confidence (4)

libraries/nestjs-libraries/src/database/prisma/users/users.service.ts:60

  • Missing closing brace for the getEmailNotifications method. The method should be properly closed with a closing brace.
  return this._usersRepository.getEmailNotifications(id);

libraries/nestjs-libraries/src/database/prisma/users/users.repository.ts:123

  • Missing closing brace for the getEmailNotifications method. The method should be properly closed with a closing brace.
  return this._user.model.user.findUnique({

libraries/nestjs-libraries/src/database/prisma/notifications/notification.service.ts:88

  • Missing closing brace for the for loop. The loop should be properly closed after the if statement.
      }

apps/backend/src/api/routes/settings.controller.ts:145

  • [nitpick] Variable name 'userValue' is ambiguous. Consider renaming to 'userSettings' or 'emailSettings' to better describe what the variable contains.
    const userValue = await this._usersService.getEmailNotifications(user.id);

@Mokkapps
Copy link
Contributor

Thanks for the PR, I would love to have an option to receive email notifications for failed posts but not for successful posts.

@nevo-david
Copy link
Contributor

@Eshwar1212-maker, thank you!
But can you change it to the type of notifications, for example:
Failed post and succesful posts

@nevo-david
Copy link
Contributor

Also, it's better to call the menu items notifications, and also add options for the in-app

@Eshwar1212-maker
Copy link
Author

Yup, I'll fix that today later when I'm free!

@Eshwar1212-maker
Copy link
Author

Hey! Thanks for the feedback

I’ve updated the UI section title to “Notifications” and kept the current toggle for email notifications under that section, as discussed. I just pushed this part .

Just to clarify — the original ticket mentioned using a single boolean (emailNotifications) with a default of true, and I’ve followed that exactly. Do you want me to create an option for failed post/successful posts should I create an enum or JSON containing those values instead of having emailNotificaitons be a boolean?

And about failed/successful post preferences, are you saying that I should get rid of everything I implemented and redo it so users can just have options for failed/successful post preferences? I wanna clarify this because it goes against what's in the original ticket. And then also on top of that you want me to add a toggle for general notifications?

My current implementation followed the ticket word for word just for email notifications. I just wanna clarify if what I did is fine, but if you want me to add all the different features, you're asking it's almost a whole new ticket isn't it?

Thank you.

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