role.ts 887 B

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