Skip to content

Commit

Permalink
Merge pull request #2066 from RitvikSardana/description-comm
Browse files Browse the repository at this point in the history
fix: description communication creation
  • Loading branch information
RitvikSardana authored Nov 28, 2024
2 parents 420d462 + f3097b7 commit c44dd5a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
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

0 comments on commit c44dd5a

Please sign in to comment.