Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: description communication creation #2066

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion desk/src/pages/TicketAgent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div v-if="ticket.data" class="flex h-screen overflow-hidden">
<div class="flex flex-1 flex-col">
<!-- ticket activities -->
<div class="overflow-y-auto flex-1">
<div class="overflow-hidden flex-1">
<Tabs v-model="tabIndex" v-slot="{ tab }" :tabs="tabs" class="h-full">
<TicketAgentActivities
ref="ticketAgentActivitiesRef"
Expand Down Expand Up @@ -156,6 +156,7 @@ import {
ActivityIcon,
EmailIcon,
} from "@/components/icons";
import { socket } from "@/socket";
import { useTicketStatusStore } from "@/stores/ticketStatus";
import { useUserStore } from "@/stores/user";
import { createToast, setupCustomActions } from "@/utils";
Expand Down Expand Up @@ -376,11 +377,18 @@ function updateTicket(fieldname: string, value: string) {
},
});
}

onMounted(() => {
document.title = props.ticketId;
socket.on("helpdesk:ticket-update", (ticketID) => {
if (ticketID === Number(props.ticketId)) {
ticket.reload();
}
});
});

onUnmounted(() => {
document.title = "Helpdesk";
socket.off("helpdesk:ticket-update");
});
</script>
17 changes: 16 additions & 1 deletion desk/src/pages/TicketCustomer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</template>

<script setup lang="ts">
import { computed, provide, ref } from "vue";
import { computed, onMounted, onUnmounted, provide, ref } from "vue";
import { createResource, Button, Breadcrumbs } from "frappe-ui";
import { Icon } from "@iconify/vue";
import { useError } from "@/composables/error";
Expand All @@ -67,6 +67,7 @@ import TicketTextEditor from "./ticket/TicketTextEditor.vue";
import { ITicket } from "./ticket/symbols";
import { useRouter } from "vue-router";
import { createToast } from "@/utils";
import { socket } from "@/socket";
import { LayoutHeader } from "@/components";
import TicketCustomerSidebar from "@/components/ticket/TicketCustomerSidebar.vue";
import { useScreenSize } from "@/composables/screen";
Expand Down Expand Up @@ -181,4 +182,18 @@ const showFeedback = computed(() => {
);
return hasAgentCommunication && isFeedbackMandatory;
});

onMounted(() => {
document.title = props.ticketId;
socket.on("helpdesk:ticket-update", (ticketID) => {
if (ticketID === Number(props.ticketId)) {
ticket.reload();
}
});
});

onUnmounted(() => {
document.title = "Helpdesk";
socket.off("helpdesk:ticket-update");
});
</script>
11 changes: 10 additions & 1 deletion desk/src/pages/Tickets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@
</template>

<script setup lang="ts">
import { ref, computed } from "vue";
import { ref, computed, onMounted, onUnmounted } from "vue";
import { useStorage } from "@vueuse/core";
import { createResource, Breadcrumbs } from "frappe-ui";
import { TicketsAgentList } from "@/components/ticket";
import { ViewControls, LayoutHeader } from "@/components";
import { useUserStore } from "@/stores/user";
import { useRoute } from "vue-router";
import { socket } from "@/socket";
const { getUser } = useUserStore();

const route = useRoute();
Expand Down Expand Up @@ -360,4 +361,12 @@ const sortableFields = createResource({
show_customer_portal_fields: isCustomerPortal,
},
});

onMounted(() => {
socket.on("helpdesk:new-ticket", () => tickets.reload());
});

onUnmounted(() => {
socket.off("helpdesk:new-ticket");
});
</script>
5 changes: 4 additions & 1 deletion helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def by_priority(query: Query, direction: Order):
}

def publish_update(self):
publish_event("helpdesk:ticket-update", {"name": self.name})
publish_event("helpdesk:ticket-update", self.name)
capture_event("ticket_updated")

def autoname(self):
Expand Down Expand Up @@ -192,6 +192,9 @@ def after_insert(self):
capture_event("ticket_created")
publish_event("helpdesk:new-ticket", {"name": self.name})

if self.get("description"):
self.create_communication_via_contact(self.description)

def on_update(self):
# flake8: noqa
if self.status == "Open":
Expand Down