This commit adds support for triggering audible desktop
notifications when:
* A message is sent to a followed topic with the global user setting
'enable_followed_topic_audible_notifications' enabled.
* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
This commit adds support for triggering visual desktop
notifications when:
* A message is sent to a followed topic with the global user setting
'enable_followed_topic_desktop_notifications' enabled.
* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
Updated user_topics.js to include all visibility policies
rather than just mute/inherit visibility policies.
Replaced muted_topics Map with `all_user_topics` Map which has
structure: {stream_id:{topic_name:{date_updated,visibility_policy}}}.
Removed add_muted_topic, remove_muted_topic functions which were
adding/removing topics in muted_topics Map. Added new function
update_user_topics which take parameter stream_id, topic,
visibility_policy, and date_updated(optional) which adds a topic
to all_user_topics with date_updated and visibility_policy,
if visibility_policy is not equal to inherit.
else, removes topic from all_user_topics.
Added get_topic_visibility_policy which returns visibility_policy
if stream_id is not undefined else return false.
Added 2 helper functions is_topic_muted and is_topic_unmuted which
uses get_topic_visibility_policy and return true if topic is
muted and unmuted respectively else return false.
Replaced switch case statement which was using add_muted_topic
and remove_muted_topic functions in set_user_topic with new function
update_user_topics.
Fixes#24244
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>