2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-04-30 16:30:44 +00:00
|
|
|
import { Collection } from '@converse/skeletor/src/collection.js'
|
|
|
|
import { ChatRoomTask } from './task'
|
|
|
|
import { initStorage } from '@converse/headless/utils/storage.js'
|
|
|
|
|
|
|
|
/**
|
2024-07-15 15:46:45 +00:00
|
|
|
* A list of {@link _converse.exports.ChatRoomTask} instances, representing all tasks associated to a MUC.
|
2024-04-30 16:30:44 +00:00
|
|
|
* @class
|
2024-07-15 15:46:45 +00:00
|
|
|
* @namespace _converse.exports.ChatRoomTasks
|
2024-04-30 16:30:44 +00:00
|
|
|
* @memberOf _converse
|
|
|
|
*/
|
|
|
|
class ChatRoomTasks extends Collection {
|
|
|
|
model = ChatRoomTask
|
|
|
|
comparator = 'order'
|
|
|
|
|
|
|
|
initialize (models, options) {
|
|
|
|
this.model = ChatRoomTask // don't know why, must do it again here
|
|
|
|
super.initialize(arguments)
|
|
|
|
this.chatroom = options.chatroom
|
|
|
|
|
|
|
|
const id = `converse-livechat-tasks-${this.chatroom.get('jid')}`
|
|
|
|
initStorage(this, id, 'session')
|
|
|
|
|
|
|
|
this.on('change:order', () => this.sort())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
ChatRoomTasks
|
|
|
|
}
|