Moderator notes WIP (#144)

This commit is contained in:
John Livingston
2024-07-30 01:24:19 +02:00
parent 20cb668e09
commit eb76e7ebb9
12 changed files with 398 additions and 10 deletions

View File

@ -27,11 +27,20 @@ class ChatRoomNotes extends Collection {
this.on('change:order', () => this.sort())
}
// async createNote (data) {
// console.log('Creating note...')
// await this.chatroom.NoteManager.createItem(this, Object.assign({}, data))
// console.log('Note created.')
// }
async createNote (data) {
data = Object.assign({}, data)
if (!data.order) {
data.order = 0 + Math.max(
0,
...(this.map(n => n.get('order') ?? 0).filter(o => !isNaN(o)))
)
}
console.log('Creating note...')
await this.chatroom.noteManager.createItem(this, data)
console.log('Note created.')
}
}
export {