Moderator notes WIP (#144):

Displaying the nickname at time of note creation if it changed.
This commit is contained in:
John Livingston 2024-07-31 21:55:20 +02:00
parent 70f702f78e
commit 48763e6173
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
7 changed files with 17 additions and 5 deletions

View File

@ -7,7 +7,7 @@
* Updating ConverseJS, to use upstream (v11 WIP). This comes with many improvments and new features. * Updating ConverseJS, to use upstream (v11 WIP). This comes with many improvments and new features.
* #146: copy message button for moderators. * #146: copy message button for moderators.
* #137: option to hide moderator name who made actions (kick, ban, message moderation, ...). * #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 ### Minor changes and fixes

View File

@ -12,6 +12,7 @@ export default class MUCNoteOccupantView extends CustomElement {
static get properties () { static get properties () {
return { return {
model: { type: Object, attribute: true }, model: { type: Object, attribute: true },
note: { type: Object, attribute: true }, // optional associated note
full_display: { type: Boolean, attribute: true } full_display: { type: Boolean, attribute: true }
} }
} }
@ -21,7 +22,7 @@ export default class MUCNoteOccupantView extends CustomElement {
} }
render () { render () {
return tplMucNoteOccupant(this, this.model) return tplMucNoteOccupant(this, this.model, this.note)
} }
} }

View File

@ -26,7 +26,7 @@ export function tplMUCNoteApp (el, mucModel) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const i18nHelp = __(LOC_online_help) const i18nHelp = __(LOC_online_help)
const helpUrl = converseLocalizedHelpUrl({ const helpUrl = converseLocalizedHelpUrl({
page: 'documentation/user/streamers/notes' page: 'documentation/user/streamers/moderator_notes'
}) })
return tplMUCApp( return tplMUCApp(

View File

@ -7,7 +7,7 @@ import { api } from '@converse/headless'
import { getAuthorStyle } from '../../../../src/utils/color.js' import { getAuthorStyle } from '../../../../src/utils/color.js'
import { __ } from 'i18n' import { __ } from 'i18n'
export function tplMucNoteOccupant (el, occupant) { export function tplMucNoteOccupant (el, occupant, note) {
const authorStyle = getAuthorStyle(occupant) const authorStyle = getAuthorStyle(occupant)
const jid = occupant.get('jid') const jid = occupant.get('jid')
const occupantId = occupant.get('occupant_id') const occupantId = occupant.get('occupant_id')
@ -28,6 +28,13 @@ export function tplMucNoteOccupant (el, occupant) {
${ ${
el.full_display el.full_display
? html`<ul aria-hidden="true"> ? html`<ul aria-hidden="true">
${
// user changed nick: display the original nick
note && note.get('about_nick') && note.get('about_nick') !== occupant.get('nick')
// eslint-disable-next-line no-undef
? html`<li title=${__(LOC_moderator_note_original_nick)}>${note.get('about_nick')}</li>`
: ''
}
${jid ? html`<li title=${__('XMPP Address')}>${jid}</li>` : ''} ${jid ? html`<li title=${__('XMPP Address')}>${jid}</li>` : ''}
${occupantId ? html`<li title=${__('Occupant Id')}>${occupantId}</li>` : ''} ${occupantId ? html`<li title=${__('Occupant Id')}>${occupantId}</li>` : ''}
</ul>` </ul>`

View File

@ -24,6 +24,7 @@ export function tplMucNote (el, note) {
<livechat-converse-muc-note-occupant <livechat-converse-muc-note-occupant
.full_display=${el.is_ocupant_filter} .full_display=${el.is_ocupant_filter}
.model=${aboutOccupant} .model=${aboutOccupant}
.note=${note}
></livechat-converse-muc-note-occupant>` ></livechat-converse-muc-note-occupant>`
: '' : ''
} }
@ -60,6 +61,7 @@ export function tplMucNote (el, note) {
<livechat-converse-muc-note-occupant <livechat-converse-muc-note-occupant
full_display=${true} full_display=${true}
.model=${aboutOccupant} .model=${aboutOccupant}
.note=${note}
></livechat-converse-muc-note-occupant> ></livechat-converse-muc-note-occupant>
` `
: '' : ''

View File

@ -58,7 +58,8 @@ const locKeys = [
'moderator_note_delete_confirm', 'moderator_note_delete_confirm',
'moderator_note_create_for_participant', 'moderator_note_create_for_participant',
'moderator_note_search_for_participant', 'moderator_note_search_for_participant',
'moderator_note_filters' 'moderator_note_filters',
'moderator_note_original_nick'
] ]
module.exports = locKeys module.exports = locKeys

View File

@ -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_create_for_participant: 'Create a new note about this participant'
moderator_note_search_for_participant: 'Search notes about this participant' moderator_note_search_for_participant: 'Search notes about this participant'
moderator_note_filters: 'Search filters' moderator_note_filters: 'Search filters'
moderator_note_original_nick: 'Nickname of the participant at the time of the note creation'