ticket-article.ts 834 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import { i18n } from '@shared/i18n'
  3. import type { TicketArticle } from '@shared/graphql/types'
  4. import type { ActivityMessageBuilder } from '../types'
  5. const path = (metaObject: TicketArticle) => {
  6. return `tickets/${metaObject.ticket.internalId}`
  7. }
  8. const messageText = (
  9. type: string,
  10. authorName: string,
  11. metaObject: TicketArticle,
  12. ): Maybe<string> => {
  13. const objectTitle = metaObject.ticket.title || '-'
  14. switch (type) {
  15. case 'create':
  16. return i18n.t('%s created article for |%s|', authorName, objectTitle)
  17. case 'update':
  18. return i18n.t('%s updated article for |%s|', authorName, objectTitle)
  19. default:
  20. return null
  21. }
  22. }
  23. export default <ActivityMessageBuilder>{
  24. messageText,
  25. path,
  26. model: 'Ticket::Article',
  27. }