diff --git a/conversejs/custom/plugins/notes/components/muc-notes-view.js b/conversejs/custom/plugins/notes/components/muc-notes-view.js
index f16656fb..cedd26dc 100644
--- a/conversejs/custom/plugins/notes/components/muc-notes-view.js
+++ b/conversejs/custom/plugins/notes/components/muc-notes-view.js
@@ -76,7 +76,10 @@ export default class MUCNotesView extends DraggablesCustomElement {
})
await this.model.createNote({
- description: description
+ description: description,
+ about_jid: ev.target.about_jid?.value || undefined,
+ about_nick: ev.target.about_nick?.value || undefined,
+ about_occupant_id: ev.target.about_occupant_id?.value || undefined
})
this.closeCreateNoteForm()
diff --git a/conversejs/custom/plugins/notes/note-pubsub-manager.js b/conversejs/custom/plugins/notes/note-pubsub-manager.js
new file mode 100644
index 00000000..3b0dbece
--- /dev/null
+++ b/conversejs/custom/plugins/notes/note-pubsub-manager.js
@@ -0,0 +1,51 @@
+// SPDX-FileCopyrightText: 2024 John Livingston
+//
+// SPDX-License-Identifier: AGPL-3.0-only
+
+import { PubSubManager } from '../../shared/lib/pubsub-manager.js'
+
+export class NotePubSubManager extends PubSubManager {
+ _additionalModelToData (item, data) {
+ super._additionalModelToData(item, data)
+
+ data.about_jid = item.get('about_jid')
+ data.about_occupant_id = item.get('about_occupant_id')
+ data.about_nick = item.get('about_nick')
+ }
+
+ _additionalDataToItemNode (data, item) {
+ super._additionalDataToItemNode(data, item)
+
+ const aboutAttributes = {}
+ if (data.about_jid !== undefined) {
+ aboutAttributes.jid = data.about_jid
+ }
+ if (data.about_nick !== undefined) {
+ aboutAttributes.nick = data.about_nick
+ }
+ const occupantId = data.about_occupant_id
+
+ if (occupantId !== undefined || Object.values(aboutAttributes).length) {
+ item.c('note-about', aboutAttributes)
+ if (occupantId) {
+ item.c('occupant-id', { xmlns: 'urn:xmpp:occupant-id:0', id: occupantId }).up()
+ }
+ item.up()
+ }
+ }
+
+ _additionalParseItemNode (itemNode, type, data) {
+ super._additionalParseItemNode(itemNode, type, data)
+
+ const about = itemNode.querySelector('& > note-about')
+ if (!about) { return }
+
+ data.about_jid = about.getAttribute('jid')
+ data.about_nick = about.getAttribute('nick')
+
+ const occupantIdEl = about.querySelector('& > occupant-id')
+ if (occupantIdEl) {
+ data.about_occupant_id = occupantIdEl.getAttribute('id')
+ }
+ }
+}
diff --git a/conversejs/custom/plugins/notes/note.js b/conversejs/custom/plugins/notes/note.js
index 67cd679c..d22b381f 100644
--- a/conversejs/custom/plugins/notes/note.js
+++ b/conversejs/custom/plugins/notes/note.js
@@ -22,6 +22,28 @@ class ChatRoomNote extends Model {
async deleteItem () {
return this.collection.chatroom.noteManager.deleteItems([this])
}
+
+ getAboutOccupant () {
+ const occupants = this.collection.chatroom?.occupants
+ if (!occupants?.findOccupant) { return undefined }
+
+ if (this.get('about_occupant_id')) {
+ const o = occupants.findOccupant({ occupant_id: this.get('about_occupant_id') })
+ if (o) { return o }
+ }
+
+ if (!this.get('about_nick') && !this.get('about_jid')) {
+ return undefined
+ }
+
+ const o = occupants.findOccupant({
+ nick: this.get('about_nick'),
+ jid: this.get('about_jid')
+ })
+ if (o) { return o }
+
+ return undefined
+ }
}
export {
diff --git a/conversejs/custom/plugins/notes/templates/muc-note.js b/conversejs/custom/plugins/notes/templates/muc-note.js
index c60e966a..87ca69de 100644
--- a/conversejs/custom/plugins/notes/templates/muc-note.js
+++ b/conversejs/custom/plugins/notes/templates/muc-note.js
@@ -9,10 +9,20 @@ export function tplMucNote (el, note) {
// eslint-disable-next-line no-undef
const i18nDelete = __(LOC_moderator_note_delete)
+ const aboutOccupant = note.getAboutOccupant()
+
return !el.edit
? html`
${note.get('description') ?? ''}
+ ${
+ aboutOccupant
+ ? html`
+
`
+ : ''
+ }