diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3
index 3e8ab5a0..1437cd5b 100644
Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ
diff --git a/osinaweb/osinacore/templates/index.html b/osinaweb/osinacore/templates/index.html
index e82d6522..c93a2444 100644
--- a/osinaweb/osinacore/templates/index.html
+++ b/osinaweb/osinacore/templates/index.html
@@ -12,7 +12,7 @@
-
+
@@ -301,6 +301,10 @@
newTicketsSocket.onmessage = function(e) {
const data = JSON.parse(e.data);
if (data.event_type === 'new_ticket') {
+ const ticketsDiv = document.getElementById('tickets-div');
+ if (ticketsDiv.classList.contains('hidden')) {
+ ticketsDiv.classList.remove('hidden');
+ }
const html = data.html;
document.getElementById('tickets').insertAdjacentHTML('afterbegin', html);
}
@@ -325,6 +329,11 @@
newTicketUpdatesSocket.onmessage = function(e) {
const data = JSON.parse(e.data);
if (data.event_type === 'new_ticket_update_group') {
+ const ticketsDiv = document.getElementById('tickets-div');
+ if (ticketsDiv.classList.contains('hidden')) {
+ ticketsDiv.classList.remove('hidden');
+ }
+
const html = data.html;
const ticketId = data.ticket_id;
console.log(ticketId);
diff --git a/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc
index 95a58adb..4dd1b138 100644
Binary files a/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc differ
diff --git a/osinaweb/support/__pycache__/consumers.cpython-310.pyc b/osinaweb/support/__pycache__/consumers.cpython-310.pyc
index f332a4d5..d1610cb2 100644
Binary files a/osinaweb/support/__pycache__/consumers.cpython-310.pyc and b/osinaweb/support/__pycache__/consumers.cpython-310.pyc differ
diff --git a/osinaweb/support/consumers.py b/osinaweb/support/consumers.py
index 1e21692d..0b229ae8 100644
--- a/osinaweb/support/consumers.py
+++ b/osinaweb/support/consumers.py
@@ -211,21 +211,26 @@ class NewTicketConsumer(WebsocketConsumer):
def new_ticket_event(self, event):
ticket_id = event['ticket_id']
ticket = Ticket.objects.get(id=ticket_id)
- is_staff_or_superuser = (
+ is_ticketstaff_member = (
hasattr(self.user, 'staffprofile') and
(self.user.staffprofile in ticket.get_all_ticket_staff() or self.user.is_superuser)
)
- if is_staff_or_superuser:
+ is_ticket_customer = (
+ hasattr(self.user, 'customerprofile') and
+ (self.user.customerprofile == ticket.customer))
+ if is_ticketstaff_member or is_ticket_customer:
context = {'ticket': ticket, 'new': True}
- html = render_to_string("details_templates/partials/ticket-display.html", context)
-
+ if is_ticketstaff_member:
+ html = render_to_string("details_templates/partials/staff-ticket-display.html", context)
+ else:
+ html = render_to_string("details_templates/partials/customer-ticket-display.html", context)
self.send(text_data=json.dumps({
'event_type': 'new_ticket',
- 'html': html
+ 'html': html,
+ 'ticket_id': ticket_id
}))
-
class NewTicketUpdateConsumer(WebsocketConsumer):
def connect(self):
self.user = self.scope['user']