Skip to content

Commit

Permalink
[FIX] Showing the id instead of the name of custom notification sound (
Browse files Browse the repository at this point in the history
  • Loading branch information
knrt10 authored and ggazzo committed May 16, 2019
1 parent d9aa8eb commit 82aceab
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/push-notifications/client/views/pushNotificationsFlexTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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,
];
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 82aceab

Please sign in to comment.