2016-02-03 18:18:14 +03:00
|
|
|
/*
|
|
|
|
* 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) {
|
2016-11-21 17:03:45 +03:00
|
|
|
|
|
|
|
_.extend(OC.Files.Client, {
|
2020-05-10 21:23:44 +03:00
|
|
|
PROPERTY_READMARKER: '{' + OC.Files.Client.NS_OWNCLOUD + '}readMarker',
|
2019-09-25 19:19:42 +03:00
|
|
|
})
|
2016-11-21 17:03:45 +03:00
|
|
|
|
2016-02-03 18:18:14 +03:00
|
|
|
/**
|
|
|
|
* @class OCA.Comments.CommentSummaryModel
|
|
|
|
* @classdesc
|
|
|
|
*
|
|
|
|
* Model containing summary information related to comments
|
2016-11-21 17:03:45 +03:00
|
|
|
* like the read marker.
|
2016-02-03 18:18:14 +03:00
|
|
|
*
|
|
|
|
*/
|
2019-11-13 15:05:10 +03:00
|
|
|
const CommentSummaryModel = OC.Backbone.Model.extend(
|
2016-02-03 18:18:14 +03:00
|
|
|
/** @lends OCA.Comments.CommentSummaryModel.prototype */ {
|
2019-09-25 19:19:42 +03:00
|
|
|
sync: OC.Backbone.davSync,
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
/**
|
2016-02-03 18:18:14 +03:00
|
|
|
* Object type
|
|
|
|
*
|
|
|
|
* @type string
|
|
|
|
*/
|
2019-09-25 19:19:42 +03:00
|
|
|
_objectType: 'files',
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
/**
|
2016-02-03 18:18:14 +03:00
|
|
|
* Object id
|
|
|
|
*
|
|
|
|
* @type string
|
|
|
|
*/
|
2019-09-25 19:19:42 +03:00
|
|
|
_objectId: null,
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
davProperties: {
|
2020-07-31 10:31:39 +03:00
|
|
|
readMarker: OC.Files.Client.PROPERTY_READMARKER,
|
2019-09-25 19:19:42 +03:00
|
|
|
},
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
/**
|
|
|
|
* Initializes the summary model
|
|
|
|
*
|
|
|
|
* @param {any} [attrs] ignored
|
|
|
|
* @param {Object} [options] destructuring object
|
|
|
|
* @param {string} [options.objectType] object type
|
|
|
|
* @param {string} [options.objectId] object id
|
|
|
|
*/
|
2020-07-31 10:26:43 +03:00
|
|
|
initialize(attrs, options) {
|
2019-09-25 19:19:42 +03:00
|
|
|
options = options || {}
|
|
|
|
if (options.objectType) {
|
|
|
|
this._objectType = options.objectType
|
|
|
|
}
|
|
|
|
},
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2020-07-31 10:26:43 +03:00
|
|
|
url() {
|
2019-09-25 19:19:42 +03:00
|
|
|
return OC.linkToRemote('dav') + '/comments/'
|
|
|
|
+ encodeURIComponent(this._objectType) + '/'
|
|
|
|
+ encodeURIComponent(this.id) + '/'
|
2019-11-13 15:05:10 +03:00
|
|
|
},
|
2019-09-25 19:19:42 +03:00
|
|
|
})
|
2016-02-03 18:18:14 +03:00
|
|
|
|
2019-09-25 19:19:42 +03:00
|
|
|
OCA.Comments.CommentSummaryModel = CommentSummaryModel
|
|
|
|
})(OC, OCA)
|