forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Desktop-View - Drafts in ticket detail view.
Co-authored-by: Benjamin Scharf <[email protected]> Co-authored-by: Dominik Klein <[email protected]> Co-authored-by: Florian Liebe <[email protected]> Co-authored-by: Mantas Masalskis <[email protected]> Co-authored-by: Tobias Schäfer <[email protected]>
- Loading branch information
1 parent
5c0d888
commit 7667a7d
Showing
63 changed files
with
2,264 additions
and
287 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
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
72 changes: 72 additions & 0 deletions
72
app/frontend/apps/desktop/pages/ticket/__tests__/ticket-detail-view-draft.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,72 @@ | ||
// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
import { within } from '@testing-library/vue' | ||
|
||
import { visitView } from '#tests/support/components/visitView.ts' | ||
import { mockPermissions } from '#tests/support/mock-permissions.ts' | ||
|
||
import { mockFormUpdaterQuery } from '#shared/components/Form/graphql/queries/formUpdater.mocks.ts' | ||
import { mockTicketQuery } from '#shared/entities/ticket/graphql/queries/ticket.mocks.ts' | ||
import { createDummyTicket } from '#shared/entities/ticket-article/__tests__/mocks/ticket.ts' | ||
|
||
describe('Ticket detail view - draft handling', () => { | ||
describe('when user is an agent', () => { | ||
beforeEach(() => { | ||
mockPermissions(['ticket.agent']) | ||
}) | ||
|
||
it('shows save as draft if it is enabled for group and user is agent', async () => { | ||
mockFormUpdaterQuery({ | ||
formUpdater: { | ||
fields: {}, | ||
flags: { | ||
hasSharedDraft: true, | ||
}, | ||
}, | ||
}) | ||
|
||
mockTicketQuery({ | ||
ticket: createDummyTicket(), | ||
}) | ||
|
||
const view = await visitView('/tickets/1') | ||
|
||
const actionMenu = await view.findByLabelText( | ||
'Additional ticket edit actions', | ||
) | ||
|
||
await view.events.click(actionMenu) | ||
|
||
const menu = await view.findByRole('menu') | ||
|
||
expect(within(menu).getByText('Save as draft')).toBeInTheDocument() | ||
}) | ||
}) | ||
|
||
describe('when user is an customer', () => { | ||
beforeEach(() => { | ||
mockPermissions(['ticket.customer']) | ||
}) | ||
|
||
it('shows no save as draft if it an customer', async () => { | ||
mockFormUpdaterQuery({ | ||
formUpdater: { | ||
fields: {}, | ||
flags: { | ||
hasSharedDraft: true, | ||
}, | ||
}, | ||
}) | ||
|
||
mockTicketQuery({ | ||
ticket: createDummyTicket(), | ||
}) | ||
|
||
const view = await visitView('/tickets/1') | ||
|
||
expect( | ||
view.queryByLabelText('Additional ticket edit actions'), | ||
).not.toBeInTheDocument() | ||
}) | ||
}) | ||
}) |
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
File renamed without changes.
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
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
27 changes: 27 additions & 0 deletions
27
.../pages/ticket/components/TicketDetailView/TicketDetailBottomBar/TicketSharedDraftZoom.vue
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,27 @@ | ||
<!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ --> | ||
|
||
<script setup lang="ts"> | ||
import type { FormRef } from '#shared/components/Form/types.ts' | ||
|
||
import CommonButton from '#desktop/components/CommonButton/CommonButton.vue' | ||
import { useTicketSharedDraft } from '#desktop/pages/ticket/composables/useTicketSharedDraft.ts' | ||
|
||
defineProps<{ | ||
sharedDraftId?: string | null | ||
form?: FormRef | ||
}>() | ||
|
||
const { openSharedDraftFlyout } = useTicketSharedDraft() | ||
</script> | ||
|
||
<template> | ||
<div class="flex items-center gap-2.5"> | ||
<CommonButton | ||
prefix-icon="template" | ||
size="large" | ||
variant="tertiary" | ||
@click="openSharedDraftFlyout('detail-view', sharedDraftId, form)" | ||
>{{ $t('Draft Available') }}</CommonButton | ||
> | ||
</div> | ||
</template> |
Oops, something went wrong.