-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
invites: Add option to receive direct notification on accepted invitations. #28819
base: main
Are you sure you want to change the base?
Conversation
Hello @zulip/server-onboarding members, this pull request was labeled with the "area: onboarding" label, so you may want to check it out! |
5c4280a
to
8cd21af
Compare
As requested in the PR template, please post screenshots of all your changes in the PR description. It is very difficult to review a video. |
Yeah sure, I have updated the PR description to add UI changes. |
Thanks! Looking at the screenshots, in the invite modal, let's move the checkbox to be just below the Emails text box. I've updated the issue as well. |
(I also filed #28834 while looking at this PR.) |
Sure, I have updated the code as well as created a PR fixing the new issue. |
8cd21af
to
d3c28b2
Compare
Thanks! @sahil839 are you up for reviewing this one? I haven't tested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posted few comments.
99aeaaf
to
383656e
Compare
@sahil839 I have addressed the previous feedbacks. Hope that works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shashank-23002 Posted a few comments related to avoiding passing the paramters where we already have a default for now in tests and migration.
Also, you should add a test for checking that the message is not sent when send_notification
is false.
zerver/migrations/0498_alter_preregistrationuser_send_notification.py
Outdated
Show resolved
Hide resolved
383656e
to
6ffe643
Compare
Thanks @sahil839 for the review. I think I have cleaned up the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to test whether the message was received by the referrer when send_notification
is True
and not received when send_notification
is False
for the invite. You can do this by doing an appropriate query like we do here.
You can read the existing tests and then write the test accordingly.
6ffe643
to
c0a19c4
Compare
Thanks @timabbott I hope the present changes might be good to go. |
zerver/views/invite.py
Outdated
@@ -48,6 +48,9 @@ def invite_users_backend( | |||
request: HttpRequest, | |||
user_profile: UserProfile, | |||
invitee_emails_raw: str = REQ("invitee_emails"), | |||
notify_referrer_on_join: bool = REQ( | |||
"notify_referrer_on_join", json_validator=check_bool, default=True | |||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These REQ parameters are sorted; please preserve that, and take care with similar sorted elements elsewhere when adding something to a list of self-similar things.
zerver/openapi/zulip.yaml
Outdated
type: boolean | ||
description: | | ||
A boolean specifying whether the referrer has opted to receive direct messages | ||
from the notification bot when an invited user joins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All copies of this should have the Changes
entry.
zerver/openapi/zulip.yaml
Outdated
from the notification bot. If `false` the referrer will not receive a notification for | ||
accepted invitations. | ||
|
||
**Changes**: New in Zulip 9.0 (feature level 254). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"A boolean indicating whether the referrer would like to receive a direct message from Notification Bot a user account is created using this invitation."
You should also add default: true
so that information is displayed, and example: false
seems more appropriate given that default.
Please post screenshots of the resulting API documentation once you've fixed this up.
This changes entry should include "Previously, referrers always received such direct messages."
zerver/tests/test_invite.py
Outdated
).last() | ||
|
||
self.assertIsNone( | ||
invite_acceptance_notification_message, "Unexpected referrerr message found." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this check; "Unexpected referrerr message found."
has a pretty weird typo, and also, it seems like it might be possible for the user to have received some unrelated DM previously?
Overall looks decent; posted a few comments on API documentation. |
@shashank-23002 ping on resolving the feedback here. |
fcc24bc
to
20382e6
Compare
20382e6
to
30a22d1
Compare
30a22d1
to
ec67786
Compare
ec67786
to
63e88aa
Compare
63e88aa
to
056cf78
Compare
@timabbott PTAL |
Cool thanks for bumping this, I'll see if I can review today. |
056cf78
to
c324534
Compare
Previously, when a referrer's invitation to Zulip was accepted, they got a notification from notification-bot indicating their invitation has been accepted. This commit adds an option for referrer to decide whether he wants to receive the direct notification from the notification-bot. Fixes: zulip#20398
c324534
to
715caef
Compare
@timabbott bumping this thread so that this may not lose track. |
Heads up @shashank-23002, 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 |
Previously, when a user's invitation to Zulip was accepted, they received a direct message from welcome bot that their invitations has been accepted. However, some users may not want to receive such a message, e.g. because they are already following new user notifications in a stream, or they simply don't need to know when new users join.
Presently , there is an additional personal notification setting using you which you can decide whether you want to receive direct message from welcome bot when an invited user joins.
Fixes: #20398.
Screenshots and screen captures:
When the button is checked -
The notification bot message popped up for
test2
.When the button is unchecked -
The notification bot message didn't pop up for
test1
.Screen.Recording.2024-02-04.at.6.10.59.PM.mov
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: