123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { computed } from 'vue'
- import { useApplicationStore } from '#shared/stores/application.ts'
- const ticketArticlesLoaded = new Set<string>()
- export const clearTicketArticlesLoadedState = () => {
- ticketArticlesLoaded.clear()
- }
- export const useTicketArticlesQueryVariables = () => {
- const application = useApplicationStore()
- const ticketArticlesMin = computed(() => {
- return Number(application.config.ticket_articles_min ?? 5)
- })
- const getTicketArticlesQueryVariables = (ticketId: string) => {
- if (ticketArticlesLoaded.has(ticketId)) {
- return {
- ticketId,
- loadDescription: false,
- pageSize: null,
- }
- }
- return {
- ticketId,
- pageSize: ticketArticlesMin.value,
- }
- }
- const markTicketArticlesLoaded = (ticketId: string) => {
- ticketArticlesLoaded.add(ticketId)
- }
- const allTicketArticlesLoaded = (ticketId: string) =>
- ticketArticlesLoaded.has(ticketId)
- return {
- ticketArticlesMin,
- allTicketArticlesLoaded,
- markTicketArticlesLoaded,
- getTicketArticlesQueryVariables,
- }
- }
|