ticket.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import type { Ticket } from '@shared/graphql/types'
  3. import { i18n } from '@shared/i18n'
  4. import type { ActivityMessageBuilder } from '../types'
  5. const path = (metaObject: Ticket) => {
  6. return `tickets/${metaObject.internalId}`
  7. }
  8. const messageText = (
  9. type: string,
  10. authorName: string,
  11. metaObject: Ticket,
  12. ): Maybe<string> => {
  13. const objectTitle = metaObject.title || '-'
  14. switch (type) {
  15. case 'create':
  16. return i18n.t('%s created ticket |%s|', authorName, objectTitle)
  17. case 'update':
  18. return i18n.t('%s updated ticket |%s|', authorName, objectTitle)
  19. case 'reminder_reached':
  20. return i18n.t('Pending reminder reached for ticket |%s|', objectTitle)
  21. case 'escalation':
  22. return i18n.t('Ticket |%s| has escalated!', objectTitle)
  23. case 'escalation_warning':
  24. return i18n.t('Ticket |%s| will escalate soon!', objectTitle)
  25. case 'update.merged_into':
  26. return i18n.t('Ticket |%s| was merged into another ticket', objectTitle)
  27. case 'update.received_merge':
  28. return i18n.t('Another ticket was merged into ticket |%s|', objectTitle)
  29. default:
  30. return null
  31. }
  32. }
  33. export default <ActivityMessageBuilder>{
  34. path,
  35. messageText,
  36. model: 'Ticket',
  37. }