Moderator notes WIP (#144)

This commit is contained in:
John Livingston
2024-07-30 19:47:20 +02:00
parent 704e660f37
commit 9c2b84027a
6 changed files with 121 additions and 6 deletions

View File

@ -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 {