facebook.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import type {
  3. TicketArticleAction,
  4. TicketArticleActionPlugin,
  5. TicketArticleType,
  6. } from './types'
  7. const actionPlugin: TicketArticleActionPlugin = {
  8. order: 300,
  9. addActions(ticket, article) {
  10. const type = article.type?.name
  11. if (type !== 'facebook feed comment' && type !== 'facebook feed post')
  12. return []
  13. const action: TicketArticleAction = {
  14. apps: ['mobile'],
  15. label: __('Reply'),
  16. name: type,
  17. icon: { mobile: 'mobile-reply' },
  18. view: {
  19. agent: ['change'],
  20. },
  21. perform(ticket, article, { openReplyDialog }) {
  22. const articleData = {
  23. // always a comment, doesn't depend on current article type
  24. articleType: 'facebook feed comment',
  25. body: '',
  26. inReplyTo: null,
  27. }
  28. openReplyDialog(articleData)
  29. },
  30. }
  31. return [action]
  32. },
  33. addTypes(ticket) {
  34. const descriptionType = ticket.createArticleType?.name
  35. if (descriptionType !== 'facebook feed post') return []
  36. const type: TicketArticleType = {
  37. apps: ['mobile'],
  38. value: 'facebook feed comment',
  39. label: __('Facebook'),
  40. icon: {
  41. mobile: 'mobile-facebook',
  42. },
  43. view: {
  44. agent: ['change'],
  45. },
  46. attributes: [],
  47. internal: false,
  48. contentType: 'text/plain',
  49. }
  50. return [type]
  51. },
  52. }
  53. export default actionPlugin