SharedWithMe.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
  3. *
  4. * @author John Molakvoæ <skjnldsv@protonmail.com>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Get the shared with me title
  24. *
  25. * @param {Share} share current share
  26. * @returns {string} the title
  27. */
  28. const shareWithTitle = function(share) {
  29. if (share.type === OC.Share.type_GROUP) {
  30. return t(
  31. 'files_sharing',
  32. 'Shared with you and the group {group} by {owner}',
  33. {
  34. group: share.shareWithDisplayName,
  35. owner: share.ownerDisplayName
  36. },
  37. undefined,
  38. { escape: false }
  39. )
  40. } else if (share.type === OC.Share.type_CIRCLE) {
  41. return t(
  42. 'files_sharing',
  43. 'Shared with you and {circle} by {owner}',
  44. {
  45. circle: share.shareWithDisplayName,
  46. owner: share.ownerDisplayName
  47. },
  48. undefined,
  49. { escape: false }
  50. )
  51. } else if (share.type === OC.Share.type_ROOM) {
  52. if (this.model.get('reshare').share_with_displayname) {
  53. return t(
  54. 'files_sharing',
  55. 'Shared with you and the conversation {conversation} by {owner}',
  56. {
  57. conversation: share.shareWithDisplayName,
  58. owner: share.ownerDisplayName
  59. },
  60. undefined,
  61. { escape: false }
  62. )
  63. } else {
  64. return t(
  65. 'files_sharing',
  66. 'Shared with you in a conversation by {owner}',
  67. {
  68. owner: share.ownerDisplayName
  69. },
  70. undefined,
  71. { escape: false }
  72. )
  73. }
  74. } else {
  75. return t(
  76. 'files_sharing',
  77. 'Shared with you by {owner}',
  78. { owner: share.ownerDisplayName },
  79. undefined,
  80. { escape: false }
  81. )
  82. }
  83. }
  84. export { shareWithTitle }