2024-04-29 14:46:21 +00:00
|
|
|
import { Model } from '@converse/skeletor/src/model.js'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A chat room task list.
|
|
|
|
* @class
|
|
|
|
* @namespace _converse.ChatRoomTaskList
|
|
|
|
* @memberof _converse
|
|
|
|
*/
|
|
|
|
class ChatRoomTaskList extends Model {
|
2024-04-30 15:11:10 +00:00
|
|
|
idAttribute = 'id'
|
2024-04-30 16:30:44 +00:00
|
|
|
|
|
|
|
getTasks () {
|
|
|
|
const taskListId = this.get('id')
|
|
|
|
return this.collection?.chatroom?.tasks?.filter({
|
|
|
|
list: taskListId
|
|
|
|
}) ?? []
|
|
|
|
}
|
2024-05-05 22:13:20 +00:00
|
|
|
|
2024-05-06 10:29:25 +00:00
|
|
|
async saveItem () {
|
|
|
|
console.log('Saving task list ' + this.get('id') + '...')
|
|
|
|
await this.collection.chatroom.taskManager.saveItem(this, { name })
|
|
|
|
console.log('Task list ' + this.get('id') + ' created.')
|
|
|
|
}
|
|
|
|
|
2024-05-05 22:13:20 +00:00
|
|
|
async deleteItem () {
|
|
|
|
return this.collection.chatroom.taskManager.deleteItem(this)
|
|
|
|
}
|
2024-04-29 14:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
ChatRoomTaskList
|
|
|
|
}
|