Skip to content

Commit 1f2a1da

Browse files
Merge pull request #2263 from RitvikSardana/reopen-email-once
fix: send re-open ticket not on new ticket creation
2 parents 9b29aed + 943d97c commit 1f2a1da

File tree

6 files changed

+69
-54
lines changed

6 files changed

+69
-54
lines changed

desk/src/components/ListViewBuilder.vue

+5
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ function applyFilters(filters) {
472472
isViewUpdated.value = true;
473473
defaultParams.filters = { ...filters };
474474
list.submit({ ...defaultParams });
475+
476+
// automatically update filters for default view
477+
if (!defaultParams.is_default) return;
478+
handleViewUpdate();
479+
isViewUpdated.value = false;
475480
}
476481
477482
function applySort(order_by: string) {

desk/src/components/layouts/Sidebar.vue

+44-42
Original file line numberDiff line numberDiff line change
@@ -48,49 +48,51 @@
4848
</template>
4949
</SidebarLink>
5050
</div>
51-
<div v-for="view in allViews" :key="view.label">
52-
<div
53-
v-if="!view.hideLabel && !isExpanded && view.views?.length"
54-
class="mx-2 my-2 h-1"
55-
/>
56-
<Section
57-
:label="view.label"
58-
:hideLabel="view.hideLabel"
59-
:opened="view.opened"
60-
>
61-
<template #header="{ opened, hide, toggle }">
62-
<div
63-
v-if="!hide"
64-
class="flex cursor-pointer gap-1.5 px-1 text-base font-medium text-ink-gray-5 transition-all duration-300 ease-in-out"
65-
:class="
66-
!isExpanded
67-
? 'ml-0 h-0 overflow-hidden opacity-0'
68-
: 'mt-4 h-7 w-auto opacity-100'
69-
"
70-
@click="toggle()"
71-
>
72-
<FeatherIcon
73-
name="chevron-right"
74-
class="h-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
75-
:class="{ 'rotate-90': opened }"
51+
<div class="overflow-y-auto">
52+
<div v-for="view in allViews" :key="view.label">
53+
<div
54+
v-if="!view.hideLabel && !isExpanded && view.views?.length"
55+
class="mx-2 my-2 h-1"
56+
/>
57+
<Section
58+
:label="view.label"
59+
:hideLabel="view.hideLabel"
60+
:opened="view.opened"
61+
>
62+
<template #header="{ opened, hide, toggle }">
63+
<div
64+
v-if="!hide"
65+
class="flex cursor-pointer gap-1.5 px-1 text-base font-medium text-ink-gray-5 transition-all duration-300 ease-in-out"
66+
:class="
67+
!isExpanded
68+
? 'ml-0 h-0 overflow-hidden opacity-0'
69+
: 'mt-4 h-7 w-auto opacity-100'
70+
"
71+
@click="toggle()"
72+
>
73+
<FeatherIcon
74+
name="chevron-right"
75+
class="h-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
76+
:class="{ 'rotate-90': opened }"
77+
/>
78+
<span>{{ view.label }}</span>
79+
</div>
80+
</template>
81+
<nav class="flex flex-col">
82+
<SidebarLink
83+
v-for="link in view.views"
84+
:icon="link.icon"
85+
:label="link.label"
86+
:to="link.to"
87+
:key="link.label"
88+
:is-expanded="isExpanded"
89+
:is-active="isActiveTab(link.to)"
90+
class="my-0.5 emoji"
91+
:onClick="link.onClick"
7692
/>
77-
<span>{{ view.label }}</span>
78-
</div>
79-
</template>
80-
<nav class="flex flex-col">
81-
<SidebarLink
82-
v-for="link in view.views"
83-
:icon="link.icon"
84-
:label="link.label"
85-
:to="link.to"
86-
:key="link.label"
87-
:is-expanded="isExpanded"
88-
:is-active="isActiveTab(link.to)"
89-
class="my-0.5 emoji"
90-
:onClick="link.onClick"
91-
/>
92-
</nav>
93-
</Section>
93+
</nav>
94+
</Section>
95+
</div>
9496
</div>
9597
<div class="grow" />
9698
<TrialBanner

desk/src/components/view-controls/Filter.vue

-2
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,6 @@ function parseFilters(filters) {
535535
if (["equals", "="].includes(c.operator)) {
536536
p[c.fieldname] =
537537
c.value == "Yes" ? true : c.value == "No" ? false : c.value;
538-
} else if (c.operator === "in" || c.operator === "not in") {
539-
p[c.fieldname] = [operatorMap[c.operator], c.value.split(",")];
540538
} else {
541539
p[c.fieldname] = [operatorMap[c.operator.toLowerCase()], c.value];
542540
}

desk/src/components/view-controls/QuickFilters.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<div v-if="!quickFilters.loading">
33
<FadedScrollableDiv
4-
class="flex flex-1 items-center -ml-1 flex-wrap"
4+
class="flex flex-1 items-center -ml-1 flex-wrap gap-1 gap-y-2"
55
orientation="horizontal"
66
>
77
<div
88
v-for="filter in quickFilters.data"
99
:key="filter.name"
10-
class="m-1 min-w-36"
10+
class="min-w-36"
1111
>
1212
<QuickFilterField
1313
:filter="filter"

desk/src/pages/ticket/TicketAgent.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ function filterActivities(eventType: TicketTab) {
375375
}
376376
return activities.value.filter((activity) => activity.type === eventType);
377377
}
378-
378+
const isErrorTriggered = ref(false);
379379
function updateTicket(fieldname: string, value: string) {
380380
if (value === ticket.data[fieldname]) return;
381381
updateOptimistic(fieldname, value);
382-
isLoading.value = true;
382+
383383
createResource({
384384
url: "frappe.client.set_value",
385385
params: {
@@ -392,6 +392,13 @@ function updateTicket(fieldname: string, value: string) {
392392
auto: true,
393393
onSuccess: () => {
394394
isLoading.value = false;
395+
isErrorTriggered.value = false;
396+
ticket.reload();
397+
},
398+
onError: () => {
399+
if (isErrorTriggered.value) return;
400+
isErrorTriggered.value = true;
401+
395402
ticket.reload();
396403
},
397404
});

helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def after_insert(self):
7575
capture_event("ticket_created")
7676
publish_event("helpdesk:new-ticket", {"name": self.name})
7777
if self.get("description"):
78-
self.create_communication_via_contact(self.description)
78+
self.create_communication_via_contact(self.description, new_ticket=True)
7979

8080
def on_update(self):
8181
# flake8: noqa
@@ -519,7 +519,13 @@ def reply_via_agent(
519519

520520
@frappe.whitelist()
521521
# flake8: noqa
522-
def create_communication_via_contact(self, message, attachments=[]):
522+
def create_communication_via_contact(
523+
self, message, attachments=[], new_ticket=False
524+
):
525+
526+
if not new_ticket:
527+
# send email to assigned agents
528+
self.send_reopen_email_to_agent(message)
523529

524530
if self.status == "Replied":
525531
self.status = "Open"
@@ -541,9 +547,6 @@ def create_communication_via_contact(self, message, attachments=[]):
541547
c.ignore_mandatory = True
542548
c.save(ignore_permissions=True)
543549

544-
# send email to assigned agents
545-
self.send_email_to_agent(message)
546-
547550
_attachments = self.get("attachments") or attachments or []
548551
if not len(_attachments):
549552
return
@@ -560,7 +563,7 @@ def create_communication_via_contact(self, message, attachments=[]):
560563
for url in file_urls:
561564
self.attach_file_with_doc("HD Ticket", self.name, url)
562565

563-
def send_email_to_agent(self, message):
566+
def send_reopen_email_to_agent(self, message):
564567
assigned_agents = self.get_assigned_agents()
565568
if not assigned_agents:
566569
return

0 commit comments

Comments
 (0)