organization.ts 919 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { Organization } from '#shared/graphql/types.ts'
  3. import { i18n } from '#shared/i18n.ts'
  4. import type { ActivityMessageBuilder } from '../types.ts'
  5. const path = (metaObject: Organization) => {
  6. return `organizations/${metaObject.internalId}`
  7. }
  8. const messageText = (
  9. type: string,
  10. authorName: string,
  11. metaObject?: Organization,
  12. ): Maybe<string> => {
  13. if (!metaObject) {
  14. return i18n.t('You can no longer see the organization.')
  15. }
  16. const objectTitle = metaObject.name || '-'
  17. switch (type) {
  18. case 'create':
  19. return i18n.t('%s created organization |%s|', authorName, objectTitle)
  20. case 'update':
  21. return i18n.t('%s updated organization |%s|', authorName, objectTitle)
  22. default:
  23. return null
  24. }
  25. }
  26. export default <ActivityMessageBuilder>{
  27. path,
  28. messageText,
  29. model: 'Organization',
  30. }