commentmodel.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. var NS_OWNCLOUD = 'http://owncloud.org/ns';
  12. /**
  13. * @class OCA.Comments.CommentModel
  14. * @classdesc
  15. *
  16. * Comment
  17. *
  18. */
  19. var CommentModel = OC.Backbone.Model.extend(
  20. /** @lends OCA.Comments.CommentModel.prototype */ {
  21. sync: OC.Backbone.davSync,
  22. defaults: {
  23. actorType: 'users',
  24. objectType: 'files'
  25. },
  26. davProperties: {
  27. 'id': '{' + NS_OWNCLOUD + '}id',
  28. 'message': '{' + NS_OWNCLOUD + '}message',
  29. 'actorType': '{' + NS_OWNCLOUD + '}actorType',
  30. 'actorId': '{' + NS_OWNCLOUD + '}actorId',
  31. 'actorDisplayName': '{' + NS_OWNCLOUD + '}actorDisplayName',
  32. 'creationDateTime': '{' + NS_OWNCLOUD + '}creationDateTime',
  33. 'objectType': '{' + NS_OWNCLOUD + '}objectType',
  34. 'objectId': '{' + NS_OWNCLOUD + '}objectId',
  35. 'isUnread': '{' + NS_OWNCLOUD + '}isUnread'
  36. },
  37. parse: function(data) {
  38. return {
  39. id: data.id,
  40. message: data.message,
  41. actorType: data.actorType,
  42. actorId: data.actorId,
  43. actorDisplayName: data.actorDisplayName,
  44. creationDateTime: data.creationDateTime,
  45. objectType: data.objectType,
  46. objectId: data.objectId,
  47. isUnread: (data.isUnread === 'true')
  48. };
  49. }
  50. });
  51. OCA.Comments.CommentModel = CommentModel;
  52. })(OC, OCA);