Repository: zulip/zulip

Issue:
Disable Notification Sound Not available
**Describe the bug**
I could not disable the notification sound because the page only gives 2 choices of music, and no "no sound" option.



**To Reproduce**
Go to settings -> notifications -> other notification settings -> notification sound. 

**Expected behavior**
Either a check option to disable the sound or no sound as one of options

**Screenshots**
![image](https://user-images.githubusercontent.com/11896263/89756891-55d9aa80-db01-11ea-8fca-5d11c5b2872d.png)

**Desktop (please complete the following information):**
 - Operating System:  Win 10 Home (18362)
 - Zulip Desktop Version: 5.4.0






Discussion:
Hello @zulip/server-settings members, this issue was labeled with the "area: settings (user)" label, so you may want to check it out!

<!-- areaLabelAddition -->
This seems worth supporting, and is likely quite easy.  The main decision is how to represent "no sound" in the API -- maybe the empty string would be most consistent?  I could also imagine the string "none" to avoid having multiple types here.
@timabbott   @Gittenburg 
Hey there are two ways (a) either I write silent in the array "available_notification_sounds" or should (B) or should I add files "silent.mp3 and silent .ogg" in "static/audio/notification.sounds". 
which should I do ?
I think adding a special value would be preferable to playing empty audio files (because it might confuse users if the browser indicates that the tab is playing some sounds when it's actually not).
> I think adding a special value would be preferable to playing empty audio files (because it might confuse users if the browser indicates that the tab is playing some sounds when it's actually not).

what do you mean by "special value".
Something like `"silent"`.
> I think adding a special value would be preferable to playing empty audio files (because it might confuse users if the browser indicates that the tab is playing some sounds when it's actually not).

But why, when we know that it's an empty string and it makes the notification  sound "silent" when mesage comes .so why it will create a confusion for user because they only want there notification sound "silent" or no-sound.

If we would play empty audio files browsers would probably still briefly display a speaker symbol in the tab. Don't worry about it you don't have any empty audio files in your PR anyway.
> This seems worth supporting, and is likely quite easy. The main decision is how to represent "no sound" in the API -- maybe the empty string would be most consistent? I could also imagine the string "none" to avoid having multiple types here.

> I think adding a special value would be preferable to playing empty audio files (because it might confuse users if the browser indicates that the tab is playing some sounds when it's actually not).

What about a new checkbox called `Disable notification sounds` instead? Seems cleaner both in terms of implementation (no special strings) and the settings UI.

![image](https://user-images.githubusercontent.com/15276828/96177920-3ec59780-0f4c-11eb-8075-528d89b8e148.png)

Checking the box would either hide or disable the dropdown + notification sound label. I'd like to help out with this.
@areebbeigh , we just want to have a option(silent)  inside the noditfication-sound , as said by Tim above.

@zulipbot claim
So I just realized we already have an independent mechanism for disabling notification sounds in Zulip:

![image](https://user-images.githubusercontent.com/2746074/114898020-a018d700-9dc6-11eb-95da-71f27fce311e.png)

So I think the actual issue here is a documentation/communication issue, not a feature we need to add.

@parthi2929 do you remember what you checked when trying to figure out how to disable sounds?  I'm wondering if it'd be useful to add a Help Center article one could find via google on disabling notification sounds.
I think since there is specific option about Notification sound, I went there to disable or looking for silence option. Yes, better documentation could help here. But UI could also be improvised so its more intuitive. 
Hello @tushar912, you claimed this issue to work on it, but this issue and any referenced pull requests haven't been updated for 10 days. Are you still working on this issue?

If so, please update this issue by leaving a comment on this issue to let me know that you're still working on it. Otherwise, I'll automatically remove you from this issue in 4 days.

If you've decided to work on something else, simply comment `@zulipbot abandon` so that someone else can claim it and continue from where you left off.

Thank you for your valuable contributions to Zulip!

<!-- inactiveWarning -->

Resolving patch:
diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py
--- a/zerver/views/user_settings.py
+++ b/zerver/views/user_settings.py
@@ -272,6 +272,7 @@ def json_change_notify_settings(
     if (
         notification_sound is not None
         and notification_sound not in get_available_notification_sounds()
+        and notification_sound != "none"
     ):
         raise JsonableError(_("Invalid notification sound '{}'").format(notification_sound))
 


Test patch:
diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js
--- a/frontend_tests/node_tests/notifications.js
+++ b/frontend_tests/node_tests/notifications.js
@@ -59,6 +59,7 @@ function test(label, f) {
         page_params.enable_desktop_notifications = true;
         page_params.enable_sounds = true;
         page_params.wildcard_mentions_notify = true;
+        page_params.notification_sound = "ding";
         f(override);
     });
 }
@@ -239,13 +240,35 @@ test("message_is_notifiable", () => {
     assert.equal(notifications.should_send_audible_notification(message), true);
     assert.equal(notifications.message_is_notifiable(message), false);
 
+    // Case 9: If `None` is selected as the notification sound, send no
+    // audible notification, no matter what other user configurations are.
+    message = {
+        id: 50,
+        content: "message number 7",
+        sent_by_me: false,
+        notification_sent: false,
+        mentioned: true,
+        mentioned_me_directly: true,
+        type: "stream",
+        stream: "general",
+        stream_id: general.stream_id,
+        topic: "whatever",
+    };
+    page_params.notification_sound = "none";
+    assert.equal(notifications.should_send_desktop_notification(message), true);
+    assert.equal(notifications.should_send_audible_notification(message), false);
+    assert.equal(notifications.message_is_notifiable(message), true);
+
+    // Reset state
+    page_params.notification_sound = "ding";
+
     // If none of the above cases apply
     // (ie: topic is not muted, message does not mention user,
     //  no notification sent before, message not sent by user),
     // return true to pass it to notifications settings, which will return false.
     message = {
         id: 60,
-        content: "message number 7",
+        content: "message number 8",
         sent_by_me: false,
         notification_sent: false,
         mentioned: false,