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 b9a170b20..a215fe4fe 100644 --- a/templates/moderation/assigned.html +++ b/templates/moderation/assigned.html @@ -75,6 +75,28 @@
Messages for ticket #{{ ticket.id }}
+ {% for message in ticket_messages reversed %} + {% if not message.moderator_only or can_view_moderator_only_messages %} +