Jonathan Rainville 9e70e69faf
fix(mentions): fix wrong user list given to mentions model (#16656)
Fixes #16602

This was broken when we refactored the members to use a single model for public channels. Those public channels then didn't have any members in their model they used for suggestions.
This is fixed by putting the logic in the UsersStore and reusing that store whenever we need a list of the members.
2024-10-30 15:02:46 -04:00

36 lines
1.1 KiB
QML

import QtQuick 2.15
QtObject {
id: root
property var chatCommunitySectionModule
property var chatDetails
property var usersModule
readonly property var usersModel: {
if (!chatDetails && !chatCommunitySectionModule) {
return null
}
let isFullCommunityList = !chatDetails.requiresPermissions
if (chatDetails.belongsToCommunity && isFullCommunityList && !!chatCommunitySectionModule) {
// Community channel with no permisisons. We can use the section's membersModel
return chatCommunitySectionModule.membersModel
}
return usersModule ? usersModule.model : null
}
readonly property var temporaryModel: usersModule ? usersModule.temporaryModel : null
function appendTemporaryModel(pubKey, displayName) {
usersModule.appendTemporaryModel(pubKey, displayName)
}
function removeFromTemporaryModel(pubKey) {
usersModule.removeFromTemporaryModel(pubKey)
}
function resetTemporaryModel() {
usersModule.resetTemporaryModel()
}
function updateGroupMembers() {
usersModule.updateGroupMembers()
}
}