Message search results: display original nickname if has changed.

This commit is contained in:
John Livingston
2024-08-06 17:54:07 +02:00
parent df75659a05
commit b8db486410
42 changed files with 856 additions and 401 deletions

View File

@ -11,7 +11,8 @@ import '../styles/muc-mam-search-occupant.scss'
export default class MUCMamSearchOccupantView extends CustomElement {
static get properties () {
return {
model: { type: Object, attribute: true }
model: { type: Object, attribute: true },
message: { type: Object, attribute: true } // optional message.
}
}
@ -20,7 +21,7 @@ export default class MUCMamSearchOccupantView extends CustomElement {
}
render () {
return tplMucMamSearchOccupant(this, this.model)
return tplMucMamSearchOccupant(this, this.model, this.message)
}
}

View File

@ -20,6 +20,7 @@ export function tplMucMamSearchMessage (el, mucModel, searchOccupantModel, messa
? html`
<livechat-converse-muc-mam-search-occupant
.model=${occupant}
.message=${message}
></livechat-converse-muc-mam-search-occupant>`
: ''
}

View File

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