articlePermalink.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { useBaseUrl } from '#shared/composables/useBaseUrl.ts'
  3. import { useCopyToClipboard } from '#shared/composables/useCopyToClipboard.ts'
  4. import type { TicketArticleActionPlugin, TicketArticleAction } from './types.ts'
  5. const actionPlugin: TicketArticleActionPlugin = {
  6. order: 900,
  7. addActions(ticket, article) {
  8. const action: TicketArticleAction = {
  9. apps: ['desktop'],
  10. label: __('Copy article permalink'),
  11. name: 'article-permalink',
  12. icon: 'files',
  13. view: {
  14. agent: ['read'],
  15. customer: ['read'],
  16. },
  17. link: `/tickets/${ticket.internalId}/${article.internalId}`,
  18. perform: () => {
  19. const { baseUrl } = useBaseUrl()
  20. const { copyToClipboard } = useCopyToClipboard()
  21. copyToClipboard(
  22. `${baseUrl.value}/desktop/tickets/${ticket.internalId}/${article.internalId}`,
  23. )
  24. },
  25. }
  26. return [action]
  27. },
  28. }
  29. export default actionPlugin