Skip to content
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

settings: Fix "message content in message notification emails". #27543

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kartikbhtt7
Copy link
Collaborator

@kartikbhtt7 kartikbhtt7 commented Nov 4, 2023

In user settings, if "message content in message notification emails" is disabled at an Organisation level, then the "Allow
message content in message notification emails" should be shown both disabled and greyed out. At present a user can still
enable this box, and messages notification emails still do not contain message content

This PR fixes this issue.

Fixes: #27262

Screenshot 2023-11-04 172618

Screenshot 2023-11-04 172635

Screenshot 2023-11-04 172702

Screenshot 2023-11-09 214355

ezgif com-optimize

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • [] Calls out remaining decisions and concerns.
  • [] Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@zulipbot
Copy link
Member

zulipbot commented Nov 4, 2023

Hello @zulip/server-settings members, this pull request was labeled with the "area: settings UI" label, so you may want to check it out!

@kartikbhtt7 kartikbhtt7 force-pushed the first_dev_branch branch 2 times, most recently from 0fbbde0 to 610570e Compare November 4, 2023 19:34
@alya
Copy link
Contributor

alya commented Nov 8, 2023

Thanks for working on this, @kartikbhtt7 !

Please fix the failing tests and post a comment requesting a review.

@alya
Copy link
Contributor

alya commented Nov 8, 2023

You will also need to include a screenshot showing the tooltip.

@kartikbhtt7
Copy link
Collaborator Author

kartikbhtt7 commented Nov 9, 2023

@alya
Fixed the failing tests and added the screenshot of tooltip.
I think it is ready for review

@alya
Copy link
Contributor

alya commented Nov 10, 2023

Thanks! The tooltip should be on the disabled setting itself. We don't want a separate i icon.

@kartikbhtt7 kartikbhtt7 force-pushed the first_dev_branch branch 2 times, most recently from ed6ab14 to 8b83f4b Compare November 18, 2023 20:50
@kartikbhtt7
Copy link
Collaborator Author

Thanks! The tooltip should be on the disabled setting itself. We don't want a separate i icon.

@alya
Fixed that in recent commit.
Screenshot 2023-11-19 021003

@alya
Copy link
Contributor

alya commented Nov 20, 2023

Thanks! The screenshot looks good to me now.

@sahil839 could you review this one when you have time (not an 8.0 goal)?

@alya alya added the maintainer review PR is ready for review by Zulip maintainers. label Nov 20, 2023
Copy link
Collaborator

@sahil839 sahil839 left a comment

Choose a reason for hiding this comment

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

Posted couple of comments.

const settings_is_disabled = {
message_content_in_email_notifications:
!page_params.realm_message_content_allowed_in_email_notifications,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can directly pass message_content_in_email_notifications_disabled as an argument below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in the latest commit

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, I was thinking of something else, but then I noticed that we use a loop to render the email notification settings. Hmm, I am not sure this is the right way to do this. We probably need to refactor some code in settings_config.ts that handles all these notification setttings.

We have show_push_notifications_tooltip which gives the status of whether the setting is disabled or not, but that is currently used only for mobile push notification related settings. We can probably rename it to something like disabled_notification_settings and then add message_content_allowed_in_email_notifications in that object.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A temporary workaround could be to disable the settings in JS rather in doing it in handlebar templates, but I guess the above approach seems good for long-term. Tbh I was confused why we use show_push_notifications_tooltip object to check whether the setting is enabled or not. @timabbott your thoughts on this?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I think renaming this object to disabled_notification_settings would probably suffice.

appendTo: () => document.body,
onHidden(instance) {
instance.destroy();
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

The tooltip is shown even when the setting is not disabled. Please look at existing examples in the codebase where we show tooltip only for disabled cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in the latest commit

@zulipbot
Copy link
Member

Hello @kartikbhtt7, it seems like you have referenced #27262 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #27262..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

@timabbott timabbott added the completion candidate PRs with reviews that may unblock merging label Feb 13, 2024
@timabbott
Copy link
Sponsor Member

@kartikbhtt7 are you planning to address the feedback on this? I've tagged it as something other developers can pick up since it's been quite a while.

@kartikbhtt7
Copy link
Collaborator Author

sure I'll address the feedbacks.

@kartikbhtt7
Copy link
Collaborator Author

addressed the feedback

@zulipbot zulipbot added size: M and removed size: S labels Mar 1, 2024
Copy link
Collaborator

@sahil839 sahil839 left a comment

Choose a reason for hiding this comment

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

A few points -

@kartikbhtt7
Copy link
Collaborator Author

There are some unrelated changes which should be fixed.

ig these are some changes that got introduced by the ./tools/lint command

will implement rest of the changes as mentioned.

@sahil839
Copy link
Collaborator

sahil839 commented Mar 6, 2024

ig these are some changes that got introduced by the ./tools/lint command

I don't think that would be the case. Will most probably be fixed by rebasing onto main.

@zulipbot
Copy link
Member

Heads up @kartikbhtt7, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: notifications (messages) area: settings UI bug completion candidate PRs with reviews that may unblock merging has conflicts maintainer review PR is ready for review by Zulip maintainers. size: M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes to "Allow message content in message notification emails"
5 participants