-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Mobile - Add "phone" article type
- Loading branch information
1 parent
4a547d1
commit 60409bd
Showing
8 changed files
with
128 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/frontend/shared/entities/ticket-article/action/plugins/__tests__/action-phone.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
import { defaultTicket } from '@mobile/pages/ticket/__tests__/mocks/detail-view' | ||
import { setupView } from '@tests/support/mock-user' | ||
import { createTestArticleTypes } from './utils' | ||
|
||
describe('phone type', () => { | ||
it('customer cannot use phone type', () => { | ||
setupView('customer') | ||
const { ticket } = defaultTicket() | ||
const actions = createTestArticleTypes(ticket) | ||
expect(actions.find((a) => a.value === 'phone')).toBeUndefined() | ||
}) | ||
|
||
it('agents can use phone type', () => { | ||
setupView('agent') | ||
const { ticket } = defaultTicket() | ||
ticket.policy.update = true | ||
const actions = createTestArticleTypes(ticket) | ||
expect(actions.find((a) => a.value === 'phone')).toBeDefined() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/frontend/shared/entities/ticket-article/action/plugins/phone.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
import type { TicketArticleActionPlugin, TicketArticleType } from './types' | ||
|
||
const actionPlugin: TicketArticleActionPlugin = { | ||
order: 100, | ||
|
||
addTypes() { | ||
const type: TicketArticleType = { | ||
apps: ['mobile'], | ||
value: 'phone', | ||
label: __('Phone'), | ||
icon: { | ||
mobile: 'mobile-phone', | ||
}, | ||
view: { | ||
agent: ['change'], | ||
}, | ||
attributes: ['attachments'], | ||
internal: false, | ||
} | ||
return [type] | ||
}, | ||
} | ||
|
||
export default actionPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
import { mockPermissions } from './mock-permissions' | ||
|
||
// If we change handling, we can improve it here in one function | ||
export const setupView = (view: 'agent' | 'customer') => { | ||
mockPermissions([`ticket.${view}`]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters