Task lists WIP:

* fix mod pubsub
* front-end WIP
This commit is contained in:
John Livingston
2024-05-02 17:53:08 +02:00
parent 82b741b4fc
commit ff976ee0ad
10 changed files with 88 additions and 20 deletions

View File

@ -1,7 +1,10 @@
import { Collection } from '@converse/skeletor/src/collection.js'
import { ChatRoomTaskList } from './task-list'
import { XMLNS_TASKLIST } from './constants'
import { initStorage } from '@converse/headless/utils/storage.js'
import { getUniqueId } from '@converse/headless/utils/core.js'
import { converse, api } from '@converse/headless/core'
const { $build } = converse.env
/**
* A list of {@link _converse.ChatRoomTaskList} instances, representing task lists associated to a MUC.
@ -75,6 +78,15 @@ class ChatRoomTaskLists extends Collection {
})
}
}
async createTaskList (data) {
const name = data?.name
if (!name) { throw new Error('Missing name') }
const item = $build('item').c('tasklist', { xmlns: XMLNS_TASKLIST })
item.c('name').t(name)
await api.pubsub.publish(this.chatroom.get('jid'), 'livechat-tasks', item)
}
}
export {