From 48763e617310780760e9de6e0b495fc69994dcdb Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 31 Jul 2024 21:55:20 +0200 Subject: [PATCH] Moderator notes WIP (#144): Displaying the nickname at time of note creation if it changed. --- CHANGELOG.md | 2 +- .../plugins/notes/components/muc-note-occupant-view.js | 3 ++- .../custom/plugins/notes/templates/muc-note-app.js | 2 +- .../custom/plugins/notes/templates/muc-note-occupant.js | 9 ++++++++- conversejs/custom/plugins/notes/templates/muc-note.js | 2 ++ conversejs/loc.keys.js | 3 ++- languages/en.yml | 1 + 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54cd5bbc..48143641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ * Updating ConverseJS, to use upstream (v11 WIP). This comes with many improvments and new features. * #146: copy message button for moderators. * #137: option to hide moderator name who made actions (kick, ban, message moderation, ...). -* #144: [moderator notes](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/notes/). +* #144: [moderator notes](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/moderator_notes/). ### Minor changes and fixes diff --git a/conversejs/custom/plugins/notes/components/muc-note-occupant-view.js b/conversejs/custom/plugins/notes/components/muc-note-occupant-view.js index 51ed79ae..f7121f5f 100644 --- a/conversejs/custom/plugins/notes/components/muc-note-occupant-view.js +++ b/conversejs/custom/plugins/notes/components/muc-note-occupant-view.js @@ -12,6 +12,7 @@ export default class MUCNoteOccupantView extends CustomElement { static get properties () { return { model: { type: Object, attribute: true }, + note: { type: Object, attribute: true }, // optional associated note full_display: { type: Boolean, attribute: true } } } @@ -21,7 +22,7 @@ export default class MUCNoteOccupantView extends CustomElement { } render () { - return tplMucNoteOccupant(this, this.model) + return tplMucNoteOccupant(this, this.model, this.note) } } diff --git a/conversejs/custom/plugins/notes/templates/muc-note-app.js b/conversejs/custom/plugins/notes/templates/muc-note-app.js index 24c8766d..7ea4b14a 100644 --- a/conversejs/custom/plugins/notes/templates/muc-note-app.js +++ b/conversejs/custom/plugins/notes/templates/muc-note-app.js @@ -26,7 +26,7 @@ export function tplMUCNoteApp (el, mucModel) { // eslint-disable-next-line no-undef const i18nHelp = __(LOC_online_help) const helpUrl = converseLocalizedHelpUrl({ - page: 'documentation/user/streamers/notes' + page: 'documentation/user/streamers/moderator_notes' }) return tplMUCApp( diff --git a/conversejs/custom/plugins/notes/templates/muc-note-occupant.js b/conversejs/custom/plugins/notes/templates/muc-note-occupant.js index 6de7e36c..72c50ff3 100644 --- a/conversejs/custom/plugins/notes/templates/muc-note-occupant.js +++ b/conversejs/custom/plugins/notes/templates/muc-note-occupant.js @@ -7,7 +7,7 @@ import { api } from '@converse/headless' import { getAuthorStyle } from '../../../../src/utils/color.js' import { __ } from 'i18n' -export function tplMucNoteOccupant (el, occupant) { +export function tplMucNoteOccupant (el, occupant, note) { const authorStyle = getAuthorStyle(occupant) const jid = occupant.get('jid') const occupantId = occupant.get('occupant_id') @@ -28,6 +28,13 @@ export function tplMucNoteOccupant (el, occupant) { ${ el.full_display ? html`` diff --git a/conversejs/custom/plugins/notes/templates/muc-note.js b/conversejs/custom/plugins/notes/templates/muc-note.js index dc8df7c5..92c85ee0 100644 --- a/conversejs/custom/plugins/notes/templates/muc-note.js +++ b/conversejs/custom/plugins/notes/templates/muc-note.js @@ -24,6 +24,7 @@ export function tplMucNote (el, note) { ` : '' } @@ -60,6 +61,7 @@ export function tplMucNote (el, note) { ` : '' diff --git a/conversejs/loc.keys.js b/conversejs/loc.keys.js index 5b62bc80..f5290ffd 100644 --- a/conversejs/loc.keys.js +++ b/conversejs/loc.keys.js @@ -58,7 +58,8 @@ const locKeys = [ 'moderator_note_delete_confirm', 'moderator_note_create_for_participant', 'moderator_note_search_for_participant', - 'moderator_note_filters' + 'moderator_note_filters', + 'moderator_note_original_nick' ] module.exports = locKeys diff --git a/languages/en.yml b/languages/en.yml index 9b76338d..ba9b46e1 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -603,3 +603,4 @@ moderator_note_delete_confirm: 'Are you sure you want to delete this note?' moderator_note_create_for_participant: 'Create a new note about this participant' moderator_note_search_for_participant: 'Search notes about this participant' moderator_note_filters: 'Search filters' +moderator_note_original_nick: 'Nickname of the participant at the time of the note creation'