Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/js/usersettings.js')
-rw-r--r--apps/settings/js/usersettings.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/apps/settings/js/usersettings.js b/apps/settings/js/usersettings.js
new file mode 100644
index 00000000000..fcfe556b1d9
--- /dev/null
+++ b/apps/settings/js/usersettings.js
@@ -0,0 +1,50 @@
+/* global OC */
+
+/**
+ * Copyright (c) 2016, Christoph Wurst <christoph@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+(function() {
+ 'use strict';
+
+ /**
+ * Model for storing and saving user settings
+ *
+ * @class UserSettings
+ */
+ 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;
+ }
+ if (_.isUndefined(data.data)) {
+ return null;
+ }
+ data = data.data;
+
+ var ignored = [
+ 'userId',
+ 'message'
+ ];
+
+ _.each(ignored, function(ign) {
+ if (!_.isUndefined(data[ign])) {
+ delete data[ign];
+ }
+ });
+
+ return data;
+ }
+ });
+
+ OC.Settings = OC.Settings || {};
+
+ OC.Settings.UserSettings = UserSettings;
+})(); \ No newline at end of file