From 67b936ccaaafe1bae6e18cadd2464ad68dba842e Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 26 Jan 2018 17:51:56 -0200 Subject: [PATCH] save working --- .../client/views/pushNotificationsFlexTab.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js index dab247a8abe..0954bf315db 100644 --- a/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js +++ b/packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js @@ -198,16 +198,21 @@ Template.pushNotificationsFlexTab.onCreated(function() { if (this.original[field].get() === this.form[field].get()) { return; } - const value = this.form[field].get(); + let value = this.form[field].get(); + + value = typeof value === 'boolean' ? value ? '1' : '0' : value; const rid = Session.get('openedRoom'); switch (field) { case 'desktopNotificationDuration': - return await call('saveDesktopNotificationDuration', rid, value); + await call('saveDesktopNotificationDuration', rid, value); + break; case 'audioNotifications': - return await call('saveAudioNotificationValue', rid, value); + await call('saveAudioNotificationValue', rid, value); + break; default: - return await call('saveNotificationSettings', field, value); + await call('saveNotificationSettings', rid, field, value); } + this.original[field].set(this.form[field].get()); }); };