-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
[WIP] Notify when a message with alert word is received #1301
base: main
Are you sure you want to change the base?
[WIP] Notify when a message with alert word is received #1301
Conversation
c6fb3c9
to
20d791d
Compare
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.
@Subhasish-Behera Thanks for looking at this 👍
I left some feedback inline, which I think mostly matches the feedback I gave in the stream, but of course more specific in nature :)
Certainly while this is under development it's fine to keep it as a separate test. As the PR develops you may find it's increasingly similar to what the other test does and can be combined - or not. Regarding specific points:
- I'm aware the muted aspect is distinct from the other test right now, but it's possible that we need to incorporate handling muted streams/topics there too, as a separate improvement.
- As with this PR, it's good to focus on the specific change rather than 'in the future' - unless you're going to include it in a commit straight after! So considering muted users to be an obstacle right now is not important.
As I noted, you should be able to simply use the stream_msg_template fixture. I'd also be interested as to what happened with using the general fixture; the similar test function has logic in the test that translates from types_when_notify_called
to a variable, to enable testing the title, but I don't think that should affect the logic - and should probably be in another test.
tests/model/test_model.py
Outdated
"user_id", | ||
"flags", | ||
"visual_notification_status", | ||
"display_recipient", | ||
"subject", |
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.
user_id, flags, display_recipient and subject are the same through all the test cases you have, at least so far. For that reason it's easier to omit them from the parametrize and focus on the variables that do change - that makes it easier to identify why each test case relates to specific values. The constant values you can leave as defaults based on the fixture, or if they don't work for you for some reason, set them explicitly (and say why).
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 included user_id
by seeing the model.user_id = user_id
of test_notify_users_calling_msg_type
but I will be removing user_id
totally(as it is not used).
And set the rest of them as you suggested.
Hello @zulip/server-notifications members, this pull request was labeled with the "area: notifications" label, so you may want to check it out! |
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.
This works just as per expectations on my local machine. I haven't gone through the automated tests yet, but upon manually testing it, everything seemed to work fine 👍
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.
This looks good! @Subhasish-Behera I've tested it manually and it seems to work great :)
20d791d
to
8fccae1
Compare
8fccae1
to
45dca8d
Compare
45dca8d
to
b552f79
Compare
In the notify_user function a condition of "has_alert_word" is added which also checks if stream/topic is muted(unlike mentions,wild-card_mentions). Changed the existing test function test_notify_users_calling_msg_type. Added the case for notificaiton for all private messages. Apart from that added two parameters is_topic_muted and is_stream_muted.
b552f79
to
9d53f9e
Compare
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.
@Subhasish-Behera Thanks for updating this - I left some feedback now you have extended/combined the tests 👍
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 tried this on my local machine and it worked as per expectations. Looks good to me. I have left feedback for the code written to assign value to recipient
variable. Apart from Neil's comments, this is something that can be looked into.
I'm following up on this now. |
model/test_model/conftest : Notify when a message with alert word is received
What does this PR do?
Partial fix for #588
Tested?
Commit flow
Notes & Questions
->No changes have been made to for private messages(not required as alert_words would be a subset case for this)
and in stream added the condition
not is_muted_topic
andnot is_muted_stream
when a message hasflag:'has_alert_word
'-> Added tests specifically for stream with 3 parameters
visual_notification_status
,is_stream_muted
,is_topic_muted
-> Added a new
stream_msg_fixture
inconftest.py
as msg_fixture was present for private messages but not for stream. And the same fixture has been used in added tests.