From 82aceabb5edaf7d07d47f54b9906498fbd803a3d Mon Sep 17 00:00:00 2001 From: Kautilya Tripathi Date: Thu, 16 May 2019 08:55:17 +0530 Subject: [PATCH] [FIX] Showing the id instead of the name of custom notification sound (#13660) --- .../client/views/pushNotificationsFlexTab.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/push-notifications/client/views/pushNotificationsFlexTab.js b/app/push-notifications/client/views/pushNotificationsFlexTab.js index ecae06e7c844..ffa680ed5a2e 100644 --- a/app/push-notifications/client/views/pushNotificationsFlexTab.js +++ b/app/push-notifications/client/views/pushNotificationsFlexTab.js @@ -45,12 +45,12 @@ Template.pushNotificationsFlexTab.helpers({ return Template.instance().form.audioNotifications.get(); }, audioNotificationValue() { - const value = Template.instance().form.audioNotificationValue.get(); - if (value === '0') { + const value = Template.instance().form.audioNotificationValue.get().split(' '); + if (value[0] === '0') { return t('Use_account_preference'); } - return value; + return value[1]; }, desktopNotifications() { return Template.instance().form.desktopNotifications.get(); @@ -200,14 +200,14 @@ Template.pushNotificationsFlexTab.events({ e.preventDefault(); const user = Meteor.userId(); - let value = Template.instance().form.audioNotificationValue.get(); - if (value === '0') { - value = getUserPreference(user, 'newMessageNotification'); + const value = Template.instance().form.audioNotificationValue.get().split(' '); + if (value[0] === '0') { + value[0] = getUserPreference(user, 'newMessageNotification'); } - if (value && value !== 'none') { + if (value && value[0] !== 'none') { const audioVolume = getUserPreference(user, 'notificationsSoundVolume'); - const $audio = $(`audio#${ value }`); + const $audio = $(`audio#${ value[0] }`); if ($audio && $audio[0] && $audio[0].play) { $audio[0].volume = Number((audioVolume / 100).toPrecision(2)); @@ -236,20 +236,20 @@ Template.pushNotificationsFlexTab.events({ id: `audioNotificationValue${ audio.name }`, name: 'audioNotificationValue', label: audio.name, - value: audio._id, + value: `${ audio._id } ${ audio.name }`, })); options = [ { id: 'audioNotificationValueNone', name: 'audioNotificationValue', label: 'None', - value: 'none', + value: 'none None', }, { id: 'audioNotificationValueDefault', name: 'audioNotificationValue', label: 'Default', - value: 0, + value: `${ 0 } ` + 'Default', }, ...audioAssetsArray, ]; @@ -340,7 +340,7 @@ Template.pushNotificationsPopover.onCreated(function() { }); Template.pushNotificationsPopover.onRendered(function() { - this.find(`[value=${ this.data.value }]`).checked = true; + this.find(`[value='${ this.data.value }']`).checked = true; }); Template.pushNotificationsPopover.helpers({