Task lists WIP:

* disco support
This commit is contained in:
John Livingston
2024-05-10 11:33:41 +02:00
parent b4f4eca5ea
commit 8aa12eb575
3 changed files with 22 additions and 6 deletions

View File

@ -14,9 +14,6 @@ export function getHeadingButtons (view, buttons) {
return buttons
}
// TODO: use disco to discover the feature.
// (if the chat is remote, the server could use a livechat version that does not support this feature)
// Adding a "Open task list" button.
buttons.unshift({
// eslint-disable-next-line no-undef
@ -96,6 +93,12 @@ export function initOrDestroyChatRoomTaskLists (mucModel) {
return _destroyChatRoomTaskLists(mucModel)
}
// We must check disco features
// (if the chat is remote, the server could use a livechat version that does not support this feature)
if (!mucModel.features?.get?.(XMLNS_TASKLIST) || !mucModel.features?.get?.(XMLNS_TASK)) {
return _destroyChatRoomTaskLists(mucModel)
}
const myself = mucModel.getOwnOccupant()
if (!myself || !['admin', 'owner'].includes(myself.get('affiliation'))) {
// User must be admin or owner