From 2b6e52205e3fb1c7f7f482c120e89cea89086887 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Thu, 28 Dec 2017 18:51:57 +0100 Subject: [PATCH] migrate all remaining settings setters --- js/devel/legacy.js | 17 ----------------- js/devel/settings.js | 22 +++++++++++++++++++++- templates/main.php | 6 +++--- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/js/devel/legacy.js b/js/devel/legacy.js index 3335bdf..9658bbf 100644 --- a/js/devel/legacy.js +++ b/js/devel/legacy.js @@ -50,23 +50,6 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.selectedContact = {}; $scope.lastSearch = ''; - $scope.setNotificationSetting = function () { - $.post(Sms.generateURL('/set/notification_state'), - { - 'notification': SmsSettings.enableNotifications ? 1 : 0 - } - ); - }; - - $scope.setContactOrderSetting = function () { - $.post(Sms.generateURL('/set/contact_order'), - { - 'attribute': SmsSettings.contactOrderBy, - 'reverse': SmsSettings.reverseContactOrder - } - ); - }; - // Conversations $scope.loadConversation = function (contact) { OC.Util.History.pushState('phonenumber=' + contact.nav); diff --git a/js/devel/settings.js b/js/devel/settings.js index dd65f47..9cce541 100644 --- a/js/devel/settings.js +++ b/js/devel/settings.js @@ -33,6 +33,10 @@ var SmsSettings = { }, sendMessageLimit: function () { + if (this.messageLimit === null) { + return; + } + var self = this; $.post(Sms.generateURL('/set/msglimit'), { @@ -40,7 +44,23 @@ var SmsSettings = { } ); }, - + sendNotificationFlag: function () { + var self = this; + $.post(Sms.generateURL('/set/notification_state'), + { + 'notification': self.enableNotifications ? 1 : 0 + } + ); + }, + sendContactOrder: function () { + var self = this; + $.post(Sms.generateURL('/set/contact_order'), + { + 'attribute': self.contactOrderBy, + 'reverse': self.reverseContactOrder + } + ); + }, sendCountry: function () { $.post(Sms.generateURL('/set/country'), { diff --git a/templates/main.php b/templates/main.php index 90139e0..708e6e1 100644 --- a/templates/main.php +++ b/templates/main.php @@ -40,17 +40,17 @@ use \OCA\OcSms\Lib\CountryCodes;
- - +
-