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.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 {string} [options.objectType] object type
  44. * @param {string} [options.objectId] object id
  45. */
  46. initialize: function(attrs, options) {
  47. options = options || {};
  48. if (options.objectType) {
  49. this._objectType = options.objectType;
  50. }
  51. },
  52. url: function() {
  53. return OC.linkToRemote('dav') + '/comments/' +
  54. encodeURIComponent(this._objectType) + '/' +
  55. encodeURIComponent(this.id) + '/';
  56. }
  57. });
  58. OCA.Comments.CommentSummaryModel = CommentSummaryModel;
  59. })(OC, OCA);