notifications: Fix unnecessary wildcard mention notifications.

This fixes a bug where email notifications were sent for wildcard
mentions even if the `enable_offline_email_notifications` setting was
turned off.
This was because the `notification_data` class incorrectly considered
`wildcard_mentions_notify` as an indeoendent setting, instead of a wrapper
around `enable_offline_email_notifications` and `enable_offline_push_notifications`.

Also add a test for this case.
This commit is contained in:
Abhijeet Prasad Bodas
2021-08-10 19:11:41 +05:30
committed by Tim Abbott
parent ec354ee013
commit ac70a2d2e1
6 changed files with 72 additions and 20 deletions

View File

@@ -762,9 +762,10 @@ def missedmessage_hook(
pm_email_notify=internal_data.get("pm_email_notify", False),
mention_push_notify=internal_data.get("mention_push_notify", False),
mention_email_notify=internal_data.get("mention_email_notify", False),
wildcard_mention_push_notify=internal_data.get("wildcard_mention_push_notify", False),
wildcard_mention_email_notify=internal_data.get("wildcard_mention_email_notify", False),
stream_push_notify=internal_data.get("stream_push_notify", False),
stream_email_notify=internal_data.get("stream_email_notify", False),
wildcard_mention_notify=internal_data.get("wildcard_mention_notify", False),
# Since one is by definition idle, we don't need to check online_push_enabled
online_push_enabled=False,
)