summaryrefslogtreecommitdiffstats
path: root/apps/comments/js/commentsummarymodel.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-02-03 16:18:14 +0100
committerVincent Petry <pvince81@owncloud.com>2016-02-03 16:18:14 +0100
commit85bec3ffcb0e2c948c57cee2817307af2826d847 (patch)
tree57d26e0d40e50d12da4d6913c3d30529a1e924cb /apps/comments/js/commentsummarymodel.js
parent8bb1437e240ce47e04f7bcb7dc3a56ef6b5d892b (diff)
downloadnextcloud-server-85bec3ffcb0e2c948c57cee2817307af2826d847.tar.gz
nextcloud-server-85bec3ffcb0e2c948c57cee2817307af2826d847.zip
Reset comments read marker after loading comments
Diffstat (limited to 'apps/comments/js/commentsummarymodel.js')
-rw-r--r--apps/comments/js/commentsummarymodel.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/apps/comments/js/commentsummarymodel.js b/apps/comments/js/commentsummarymodel.js
new file mode 100644
index 00000000000..d405315ca1f
--- /dev/null
+++ b/apps/comments/js/commentsummarymodel.js
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2016
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+(function(OC, OCA) {
+ var NS_OWNCLOUD = 'http://owncloud.org/ns';
+ /**
+ * @class OCA.Comments.CommentSummaryModel
+ * @classdesc
+ *
+ * Model containing summary information related to comments
+ * like the read marker.
+ *
+ */
+ var CommentSummaryModel = OC.Backbone.Model.extend(
+ /** @lends OCA.Comments.CommentSummaryModel.prototype */ {
+ sync: OC.Backbone.davSync,
+
+ /**
+ * Object type
+ *
+ * @type string
+ */
+ _objectType: 'files',
+
+ /**
+ * Object id
+ *
+ * @type string
+ */
+ _objectId: null,
+
+ davProperties: {
+ 'readMarker': '{' + NS_OWNCLOUD + '}readMarker'
+ },
+
+ /**
+ * Initializes the summary model
+ *
+ * @param {string} [options.objectType] object type
+ * @param {string} [options.objectId] object id
+ */
+ initialize: function(attrs, options) {
+ options = options || {};
+ if (options.objectType) {
+ this._objectType = options.objectType;
+ }
+ },
+
+ url: function() {
+ return OC.linkToRemote('dav') + '/comments/' +
+ encodeURIComponent(this._objectType) + '/' +
+ encodeURIComponent(this.id) + '/';
+ }
+ });
+
+ OCA.Comments.CommentSummaryModel = CommentSummaryModel;
+})(OC, OCA);
+