]> source.dussan.org Git - nextcloud-server.git/commitdiff
use PUT to update user settings
authorChristoph Wurst <christoph@owncloud.com>
Thu, 21 Apr 2016 09:19:10 +0000 (11:19 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 21 Nov 2016 10:29:38 +0000 (11:29 +0100)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
settings/Controller/UsersController.php
settings/js/federationsettingsview.js
settings/js/usersettings.js
settings/routes.php

index f06eabf6f9678303d0b59a84a413eb97d436600d..7529cedd196e38489f321ddc8e14f08951b129c2 100644 (file)
@@ -500,6 +500,7 @@ class UsersController extends Controller {
         * @PasswordConfirmationRequired
         *
         * @param string $userId
+        * @param string $avatarScope
         * @param string $displayname
         * @param string $displaynameScope
         * @param string $phone
@@ -512,7 +513,7 @@ class UsersController extends Controller {
         * @param string $addressScope
         * @return DataResponse
         */
-       public function saveUserSettings($userId,
+       public function saveUserSettings($userId, $avatarScope,
                                        $displayname, $displaynameScope,
                                        $phone, $phoneScope,
                                        $email, $emailScope,
@@ -524,6 +525,7 @@ class UsersController extends Controller {
                                'status' => 'success',
                                'data' => array(
                                        'userId' => $userId,
+                                       'avatarScope' => $avatarScope,
                                        'displayname' => $displayname,
                                        'displaynameScope' => 'public', // force value for test purposes
                                        'email' => $email,
index 997f4fef3f1e0a3bc9196a3aa17647a3e606fed6..9921ff64691681fead53e8ac903ad960c6bfaef5 100644 (file)
@@ -51,7 +51,7 @@
                                        });
                                }
                                self.listenTo(self._config, 'change:' + field + 'Scope', function () {
-                                       self._onScopeChanged(field, self._config.get(field + 'Scope'));
+                                       self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
                                });
                        });
 
@@ -77,7 +77,8 @@
                                var pos = ($heading.width() - $heading.find('label').width()) - diff;
                                scopeMenu.$el.css('right', pos);
 
-                               self._onScopeChanged(field, self._config.get(field + 'Scope'));
+                               // Restore initial state
+                               self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
                        });
                },
 
index d8d089f83deb470b142995025c1d3d327adfa9a0..fcfe556b1d9a67183ecadf6a1a7982af995753ee 100644 (file)
@@ -17,6 +17,9 @@
         */
        var UserSettings = OC.Backbone.Model.extend({
                url: OC.generateUrl('/settings/users/{id}/settings', {id: OC.currentUser}),
+               isNew: function() {
+                       return false; // Force PUT on .save()
+               },
                parse: function(data) {
                        if (_.isUndefined(data)) {
                                return null;
index ac4ade4f14ab4d6d1daa73b6cf77ca11f982bb83..d4286cd56ff52b5852ca2f0a5efa9e7a1276f2f8 100644 (file)
@@ -50,7 +50,7 @@ $application->registerRoutes($this, [
                ['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET'],
                ['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET'],
                ['name' => 'SecuritySettings#trustedDomains', 'url' => '/settings/admin/security/trustedDomains', 'verb' => 'POST'],
-               ['name' => 'Users#saveUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'POST'],
+               ['name' => 'Users#saveUserSettings', 'url' => '/settings/users/{username}/settings', 'verb' => 'PUT'],
                ['name' => 'Users#stats', 'url' => '/settings/users/stats', 'verb' => 'GET'],
                ['name' => 'LogSettings#setLogLevel', 'url' => '/settings/admin/log/level', 'verb' => 'POST'],
                ['name' => 'LogSettings#getEntries', 'url' => '/settings/admin/log/entries', 'verb' => 'GET'],