use PUT to update user settings

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Christoph Wurst 2016-04-21 11:19:10 +02:00 committed by Roeland Jago Douma
parent 78f6e29954
commit d1233b47b0
No known key found for this signature in database
GPG Key ID: F941078878347C0C
4 changed files with 10 additions and 4 deletions

View 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,

View 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'));
});
},

View 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;

View 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'],