From b01465f3f895a395e3dfb02df8af65b2d7c3b6d6 Mon Sep 17 00:00:00 2001 From: ffont Date: Fri, 8 Nov 2024 14:27:51 +0100 Subject: [PATCH 1/2] WIP showing mid messages in assigned tickets page --- templates/moderation/assigned.html | 15 +++++++++++++++ tickets/views.py | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/templates/moderation/assigned.html b/templates/moderation/assigned.html index b9a170b20..b4992f761 100644 --- a/templates/moderation/assigned.html +++ b/templates/moderation/assigned.html @@ -75,6 +75,21 @@
No sound tickets in your queue... 😊

You can do shift+click on a row to select all the rows since the last previously selected row + {% endif %} diff --git a/tickets/views.py b/tickets/views.py index 54cf4a637..cbb1864d6 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -636,7 +636,8 @@ def moderation_assigned(request, user_id): "current_page": pagination_response['current_page'], "show_pagination": show_pagination, "mod_sound_form": mod_sound_form, - "msg_form": msg_form + "msg_form": msg_form, + "can_view_moderator_only_messages": _can_view_mod_msg(request) } _add_sound_objects_to_tickets(tvars['page'].object_list) tvars.update({'section': 'assigned'}) From a7cfd3e877fa3f2edc64abf8ece5ca5cc6124822 Mon Sep 17 00:00:00 2001 From: ffont Date: Fri, 15 Nov 2024 13:41:38 +0100 Subject: [PATCH 2/2] Show ticket messages in moderation --- .../bw-frontend/src/pages/moderation.js | 10 +++++++ templates/moderation/assigned.html | 29 ++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/freesound/static/bw-frontend/src/pages/moderation.js b/freesound/static/bw-frontend/src/pages/moderation.js index 077b375be..8b9de517e 100644 --- a/freesound/static/bw-frontend/src/pages/moderation.js +++ b/freesound/static/bw-frontend/src/pages/moderation.js @@ -19,6 +19,7 @@ const messageTextArea = document.getElementsByName('message')[0]; const ticketIdsInput = document.getElementsByName('ticket')[0]; const soundInfoElementsPool = document.getElementById('sound-info-elements'); const selectedSoundsInfoPanel = document.getElementById('selected-sounds-info'); +const ticketCommentsSection = document.getElementById('ticket-comments-section'); const closeCollapsableBlocks = (soundElement) => { @@ -70,6 +71,15 @@ const postTicketsSelected = () => { } } + // Make ticket comments visible if only one ticket is selected + ticketCommentsSection.children.forEach(commentElement => { + commentElement.classList.add('display-none'); + }); + if (selectedTicketsData.length === 1) { + const commentElement = ticketCommentsSection.querySelector(`.ticket-comments[data-ticket-id="${selectedTicketsData[0]['ticketId']}"]`); + commentElement.classList.remove('display-none'); + } + // Set "ticket" field in moderation form with the ticket ids of the selected tickets const ticketIdsSerialized = selectedTicketsData.map(ticketData => ticketData['ticketId']).join('|'); ticketIdsInput.value = ticketIdsSerialized; diff --git a/templates/moderation/assigned.html b/templates/moderation/assigned.html index b4992f761..a215fe4fe 100644 --- a/templates/moderation/assigned.html +++ b/templates/moderation/assigned.html @@ -75,19 +75,26 @@
No sound tickets in your queue... 😊

You can do shift+click on a row to select all the rows since the last previously selected row -