Просмотр исходного кода

Maintenance: Desktop view - Standardize the check for updateability of the ticket and unify casting of possible boolean values.

Dusan Vuckovic 5 месяцев назад
Родитель
Сommit
b0d0340e41

+ 1 - 1
app/frontend/apps/desktop/components/Form/fields/FieldDate/FieldDateTimeInput.vue

@@ -72,7 +72,7 @@ const { isDarkMode } = storeToRefs(useThemeStore())
       :uid="context.id"
       :model-type="valueFormat"
       :name="context.node.name"
-      :clearable="context.clearable ?? false"
+      :clearable="!!context.clearable"
       :disabled="context.disabled"
       :range="context.range"
       :enable-time-picker="timePicker"

+ 2 - 2
app/frontend/apps/desktop/entities/channel-email/composables/useEmailInboundForm.ts

@@ -32,8 +32,8 @@ export const useEmailInboundForm = () => {
   ) => {
     metaInformationInbound.value = {
       contentMessages: data.contentMessages || 0,
-      archivePossible: data.archivePossible || false,
-      archivePossibleIsFallback: data.archivePossibleIsFallback || false,
+      archivePossible: !!data.archivePossible,
+      archivePossibleIsFallback: !!data.archivePossibleIsFallback,
       archiveWeekRange: data.archiveWeekRange || 0,
       nextAction,
     }

+ 1 - 1
app/frontend/apps/desktop/entities/ticket/__tests__/mocks/provideTicketInformationMocks.ts

@@ -21,7 +21,7 @@ export const provideTicketInformationMocks = (
     ticketInternalId: ref(ticket.internalId),
     ticketId: computed(() => ticket.id),
     ticket: computed(() => ticket),
-    canUpdateTicket: computed(() => ticket.policy.update || false),
+    isTicketEditable: computed(() => !!ticket.policy.update),
     ...overrideProvideOptions,
   } as TicketInformation)
 }

+ 1 - 1
app/frontend/apps/desktop/entities/ticket/types.ts

@@ -9,7 +9,7 @@ export interface TicketInformation {
   ticket: ComputedRef<TicketById | undefined>
   ticketId: ComputedRef<ID>
   ticketInternalId: Ref<number>
-  canUpdateTicket: ComputedRef<boolean>
+  isTicketEditable: ComputedRef<boolean>
   form: FormRefParameter
   showTicketArticleReplyForm: () => void
   newTicketArticlePresent: Ref<boolean | undefined>

+ 1 - 1
app/frontend/apps/desktop/entities/user/current/stores/taskbarTabs.ts

@@ -388,7 +388,7 @@ export const useUserCurrentTaskbarTabsStore = defineStore(
           app: EnumTaskbarApp.Desktop,
           callback: taskbarTab.type,
           key: taskbarTab.tabEntityKey,
-          notify: taskbarTab.notify ?? false,
+          notify: !!taskbarTab.notify,
           prio: taskbarTab.order,
           dirty: taskbarTab.dirty,
         },

+ 2 - 2
app/frontend/apps/desktop/pages/ticket/components/TicketDetailView/ArticleBubble/ArticleBubbleActionList.vue

@@ -20,7 +20,7 @@ const props = defineProps<{
   article: TicketArticle
 }>()
 
-const { ticket, canUpdateTicket, showTicketArticleReplyForm, form } =
+const { ticket, isTicketEditable, showTicketArticleReplyForm, form } =
   useTicketInformation()
 
 const { isTouchDevice } = useTouchDevice()
@@ -126,7 +126,7 @@ const actions = computed(() => {
 
 <template>
   <div
-    v-if="canUpdateTicket"
+    v-if="isTicketEditable"
     class="absolute bottom-0 flex w-fit translate-y-1/2 items-center gap-1 ltr:right-3 rtl:left-3"
     :class="{ 'ltr:left-3 rtl:right-3': position === 'left' }"
   >

+ 2 - 2
app/frontend/apps/desktop/pages/ticket/components/TicketDetailView/TicketDetailBottomBar/TicketDetailBottomBar.vue

@@ -17,7 +17,7 @@ export interface Props {
   dirty: boolean
   disabled: boolean
   formNodeId?: string
-  canUpdateTicket: boolean
+  isTicketEditable: boolean
   groupId?: string
   liveUserList: TicketLiveAppUser[]
 }
@@ -65,7 +65,7 @@ const actionItems = computed(() => {
 
 <template>
   <TicketLiveUsers v-if="liveUserList?.length" :live-user-list="liveUserList" />
-  <template v-if="canUpdateTicket">
+  <template v-if="isTicketEditable">
     <CommonButton
       v-if="dirty"
       size="large"

+ 2 - 2
app/frontend/apps/desktop/pages/ticket/components/TicketDetailView/__tests__/TicketDetailBottomBar.spec.ts

@@ -32,7 +32,7 @@ const renderTicketDetailBottomBar = (props?: Partial<Props>) =>
       disabled: false,
       formNodeId: 'form-node-id-test',
       dirty: false,
-      canUpdateTicket: true,
+      isTicketEditable: true,
       groupId: convertToGraphQLId('Group', 2),
       liveUserList: [],
       ...props,
@@ -141,7 +141,7 @@ describe('TicketDetailBottomBar', () => {
 
   it('hides action menu, submit and cancel buttons for agent without update permission', async () => {
     const wrapper = renderTicketDetailBottomBar({
-      canUpdateTicket: false,
+      isTicketEditable: false,
     })
 
     expect(

+ 2 - 2
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarChecklist/TicketSidebarChecklist.vue

@@ -19,7 +19,7 @@ defineProps<TicketSidebarProps>()
 
 const emit = defineEmits<TicketSidebarEmits>()
 
-const { incompleteItemCount, checklist, isLoadingChecklist, canUpdateTicket } =
+const { incompleteItemCount, checklist, isLoadingChecklist, isTicketEditable } =
   useTicketChecklist()
 
 const badge = computed<TicketSidebarButtonBadgeDetails | undefined>(() => {
@@ -52,7 +52,7 @@ onMounted(() => {
       :sidebar-plugin="sidebarPlugin"
       :checklist="checklist"
       :loading="isLoadingChecklist"
-      :readonly="!canUpdateTicket"
+      :readonly="!isTicketEditable"
     />
   </TicketSidebarWrapper>
 </template>

+ 1 - 1
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarChecklist/__tests__/TicketSidebarChecklist.spec.ts

@@ -44,7 +44,7 @@ vi.mock('#desktop/pages/ticket/composables/useTicketInformation.ts', () => ({
     ticketInternalId: ref(ticket.value.internalId),
     ticketId: computed(() => ticket.value.id),
     ticket: computed(() => ticket.value),
-    canUpdateTicket: computed(() => !!ticket.value?.policy.update),
+    isTicketEditable: computed(() => !!ticket.value?.policy.update),
   }),
 }))
 

Некоторые файлы не были показаны из-за большого количества измененных файлов