logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

notification.vue (8946B)


  1. <template>
  2. <article
  3. v-if="notification.type === 'mention'"
  4. >
  5. <Status
  6. class="Notification"
  7. :compact="true"
  8. :statusoid="notification.status"
  9. @interacted="interacted"
  10. />
  11. </article>
  12. <article v-else>
  13. <div
  14. v-if="needMute && !unmuted"
  15. class="Notification container -muted"
  16. >
  17. <small>
  18. <user-link
  19. :user="notification.from_profile"
  20. :at="false"
  21. />
  22. </small>
  23. <button
  24. class="button-unstyled unmute"
  25. @click.prevent="toggleMute"
  26. >
  27. <FAIcon
  28. class="fa-scale-110 fa-old-padding"
  29. icon="eye-slash"
  30. />
  31. </button>
  32. </div>
  33. <div
  34. v-else
  35. class="Notification non-mention"
  36. :class="[userClass, { highlighted: userStyle }, '-type--' + notification.type]"
  37. :style="[ userStyle ]"
  38. >
  39. <a
  40. class="avatar-container"
  41. :href="$router.resolve(userProfileLink).href"
  42. @click.prevent
  43. >
  44. <UserPopover
  45. :user-id="notification.from_profile.id"
  46. :overlay-centers="true"
  47. >
  48. <UserAvatar
  49. class="post-avatar"
  50. :bot="botIndicator"
  51. :compact="true"
  52. :better-shadow="betterShadow"
  53. :user="notification.from_profile"
  54. />
  55. </UserPopover>
  56. </a>
  57. <div class="notification-right">
  58. <span class="notification-details">
  59. <div class="name-and-action">
  60. <!-- eslint-disable vue/no-v-html -->
  61. <bdi v-if="!!notification.from_profile.name_html">
  62. <RichContent
  63. class="username"
  64. :title="'@'+notification.from_profile.screen_name_ui"
  65. :html="notification.from_profile.name_html"
  66. :emoji="notification.from_profile.emoji"
  67. />
  68. </bdi>
  69. <!-- eslint-enable vue/no-v-html -->
  70. <span
  71. v-else
  72. class="username"
  73. :title="'@'+notification.from_profile.screen_name_ui"
  74. >
  75. {{ notification.from_profile.name }}
  76. </span>
  77. {{ ' ' }}
  78. <span v-if="notification.type === 'like'">
  79. <FAIcon
  80. class="type-icon"
  81. icon="star"
  82. />
  83. {{ ' ' }}
  84. <small>{{ $t('notifications.favorited_you') }}</small>
  85. </span>
  86. <span v-if="notification.type === 'repeat'">
  87. <FAIcon
  88. class="type-icon"
  89. icon="retweet"
  90. :title="$t('tool_tip.repeat')"
  91. />
  92. {{ ' ' }}
  93. <small>{{ $t('notifications.repeated_you') }}</small>
  94. </span>
  95. <span v-if="notification.type === 'follow'">
  96. <FAIcon
  97. class="type-icon"
  98. icon="user-plus"
  99. />
  100. {{ ' ' }}
  101. <small>{{ $t('notifications.followed_you') }}</small>
  102. </span>
  103. <span v-if="notification.type === 'follow_request'">
  104. <FAIcon
  105. class="type-icon"
  106. icon="user"
  107. />
  108. {{ ' ' }}
  109. <small>{{ $t('notifications.follow_request') }}</small>
  110. </span>
  111. <span v-if="notification.type === 'move'">
  112. <FAIcon
  113. class="type-icon"
  114. icon="suitcase-rolling"
  115. />
  116. {{ ' ' }}
  117. <small>{{ $t('notifications.migrated_to') }}</small>
  118. </span>
  119. <span v-if="notification.type === 'pleroma:emoji_reaction'">
  120. <small>
  121. <i18n-t
  122. scope="global"
  123. keypath="notifications.reacted_with"
  124. >
  125. <img
  126. v-if="notification.emoji_url"
  127. class="emoji-reaction-emoji emoji-reaction-emoji-image"
  128. :src="notification.emoji_url"
  129. :alt="notification.emoji"
  130. :title="notification.emoji"
  131. >
  132. <span
  133. v-else
  134. class="emoji-reaction-emoji"
  135. >{{ notification.emoji }}</span>
  136. </i18n-t>
  137. </small>
  138. </span>
  139. <span v-if="notification.type === 'pleroma:report'">
  140. <small>{{ $t('notifications.submitted_report') }}</small>
  141. </span>
  142. <span v-if="notification.type === 'poll'">
  143. <FAIcon
  144. class="type-icon"
  145. icon="poll-h"
  146. />
  147. {{ ' ' }}
  148. <small>{{ $t('notifications.poll_ended') }}</small>
  149. </span>
  150. </div>
  151. <div
  152. v-if="isStatusNotification"
  153. class="timeago"
  154. >
  155. <router-link
  156. v-if="notification.status"
  157. :to="{ name: 'conversation', params: { id: notification.status.id } }"
  158. class="timeago-link faint"
  159. >
  160. <Timeago
  161. :time="notification.created_at"
  162. :auto-update="240"
  163. />
  164. </router-link>
  165. <button
  166. class="button-unstyled expand-icon"
  167. :title="$t('tool_tip.toggle_expand')"
  168. :aria-expanded="statusExpanded"
  169. @click.prevent="toggleStatusExpanded"
  170. >
  171. <FAIcon
  172. class="fa-scale-110"
  173. fixed-width
  174. :icon="statusExpanded ? 'compress-alt' : 'expand-alt'"
  175. />
  176. </button>
  177. </div>
  178. <div
  179. v-else
  180. class="timeago"
  181. >
  182. <span class="faint">
  183. <Timeago
  184. :time="notification.created_at"
  185. :auto-update="240"
  186. />
  187. </span>
  188. </div>
  189. <button
  190. v-if="needMute"
  191. class="button-unstyled"
  192. :title="$t('tool_tip.toggle_mute')"
  193. :aria-expanded="!unmuted"
  194. @click.prevent="toggleMute"
  195. >
  196. <FAIcon
  197. class="fa-scale-110 fa-old-padding"
  198. icon="eye-slash"
  199. />
  200. </button>
  201. </span>
  202. <div
  203. v-if="notification.type === 'follow' || notification.type === 'follow_request'"
  204. class="follow-text"
  205. >
  206. <user-link
  207. class="follow-name"
  208. :user="notification.from_profile"
  209. />
  210. <div
  211. v-if="notification.type === 'follow_request'"
  212. style="white-space: nowrap;"
  213. >
  214. <button
  215. class="button-unstyled"
  216. :title="$t('tool_tip.accept_follow_request')"
  217. @click="approveUser()"
  218. >
  219. <FAIcon
  220. icon="check"
  221. class="fa-scale-110 fa-old-padding follow-request-accept"
  222. />
  223. </button>
  224. <button
  225. class="button-unstyled"
  226. :title="$t('tool_tip.reject_follow_request')"
  227. @click="denyUser()"
  228. >
  229. <FAIcon
  230. icon="times"
  231. class="fa-scale-110 fa-old-padding follow-request-reject"
  232. />
  233. </button>
  234. </div>
  235. </div>
  236. <div
  237. v-else-if="notification.type === 'move'"
  238. class="move-text"
  239. >
  240. <user-link
  241. :user="notification.target"
  242. />
  243. </div>
  244. <Report
  245. v-else-if="notification.type === 'pleroma:report'"
  246. :report-id="notification.report.id"
  247. />
  248. <template v-else>
  249. <StatusContent
  250. :compact="!statusExpanded"
  251. :status="notification.status"
  252. />
  253. </template>
  254. </div>
  255. </div>
  256. <teleport to="#modal">
  257. <confirm-modal
  258. v-if="showingApproveConfirmDialog"
  259. :title="$t('user_card.approve_confirm_title')"
  260. :confirm-text="$t('user_card.approve_confirm_accept_button')"
  261. :cancel-text="$t('user_card.approve_confirm_cancel_button')"
  262. @accepted="doApprove"
  263. @cancelled="hideApproveConfirmDialog"
  264. >
  265. {{ $t('user_card.approve_confirm', { user: user.screen_name_ui }) }}
  266. </confirm-modal>
  267. <confirm-modal
  268. v-if="showingDenyConfirmDialog"
  269. :title="$t('user_card.deny_confirm_title')"
  270. :confirm-text="$t('user_card.deny_confirm_accept_button')"
  271. :cancel-text="$t('user_card.deny_confirm_cancel_button')"
  272. @accepted="doDeny"
  273. @cancelled="hideDenyConfirmDialog"
  274. >
  275. {{ $t('user_card.deny_confirm', { user: user.screen_name_ui }) }}
  276. </confirm-modal>
  277. </teleport>
  278. </article>
  279. </template>
  280. <script src="./notification.js"></script>
  281. <style src="./notification.scss" lang="scss"></style>