You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commentsummarymodel.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2016
  3. *
  4. * This file is licensed under the Affero General Public License version 3
  5. * or later.
  6. *
  7. * See the COPYING-README file.
  8. *
  9. */
  10. (function(OC, OCA) {
  11. _.extend(OC.Files.Client, {
  12. PROPERTY_READMARKER: '{' + OC.Files.Client.NS_OWNCLOUD + '}readMarker'
  13. })
  14. /**
  15. * @class OCA.Comments.CommentSummaryModel
  16. * @classdesc
  17. *
  18. * Model containing summary information related to comments
  19. * like the read marker.
  20. *
  21. */
  22. var CommentSummaryModel = OC.Backbone.Model.extend(
  23. /** @lends OCA.Comments.CommentSummaryModel.prototype */ {
  24. sync: OC.Backbone.davSync,
  25. /**
  26. * Object type
  27. *
  28. * @type string
  29. */
  30. _objectType: 'files',
  31. /**
  32. * Object id
  33. *
  34. * @type string
  35. */
  36. _objectId: null,
  37. davProperties: {
  38. 'readMarker': OC.Files.Client.PROPERTY_READMARKER
  39. },
  40. /**
  41. * Initializes the summary model
  42. *
  43. * @param {any} [attrs] ignored
  44. * @param {Object} [options] destructuring object
  45. * @param {string} [options.objectType] object type
  46. * @param {string} [options.objectId] object id
  47. */
  48. initialize: function(attrs, options) {
  49. options = options || {}
  50. if (options.objectType) {
  51. this._objectType = options.objectType
  52. }
  53. },
  54. url: function() {
  55. return OC.linkToRemote('dav') + '/comments/'
  56. + encodeURIComponent(this._objectType) + '/'
  57. + encodeURIComponent(this.id) + '/'
  58. }
  59. })
  60. OCA.Comments.CommentSummaryModel = CommentSummaryModel
  61. })(OC, OCA)