fix(@desktop/chat): make chat group popup work again

This broke during the modal refactoring because we're no longer relying
on `chatsModel.contextChannel`.

Passing the channel item to the popup ensures it's properly hydrated again.

Closes #3050
This commit is contained in:
Pascal Precht 2021-07-28 12:41:37 +02:00 committed by Iuri Matias
parent fd01303867
commit 0dbfb61093
3 changed files with 9 additions and 9 deletions

View File

@ -222,7 +222,10 @@ Item {
chatInfoButton.onClicked: { chatInfoButton.onClicked: {
switch (chatsModel.channelView.activeChannel.chatType) { switch (chatsModel.channelView.activeChannel.chatType) {
case Constants.chatTypePrivateGroupChat: case Constants.chatTypePrivateGroupChat:
openPopup(groupInfoPopupComponent, {channelType: GroupInfoPopup.ChannelType.ActiveChannel}) openPopup(groupInfoPopupComponent, {
channelType: GroupInfoPopup.ChannelType.ActiveChannel,
channel: chatsModel.channelView.activeChannel
})
break; break;
case Constants.chatTypeOneToOne: case Constants.chatTypeOneToOne:
openProfilePopup(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id), openProfilePopup(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id),

View File

@ -44,7 +44,10 @@ StatusPopupMenu {
) )
} }
if (chatItem.chatType === Constants.chatTypePrivateGroupChat) { if (chatItem.chatType === Constants.chatTypePrivateGroupChat) {
return openPopup(groupInfoPopupComponent, {channelType: GroupInfoPopup.ChannelType.ContextChannel}) return openPopup(groupInfoPopupComponent, {
channel: chatItem,
channelType: GroupInfoPopup.ChannelType.ContextChannel
})
} }
} }
} }

View File

@ -18,13 +18,7 @@ ModalPopup {
readonly property int maxMembers: 10 readonly property int maxMembers: 10
property var pubKeys: [] property var pubKeys: []
property int channelType: GroupInfoPopup.ChannelType.ActiveChannel property int channelType: GroupInfoPopup.ChannelType.ActiveChannel
property QtObject channel: { property QtObject channel
if (channelType === GroupInfoPopup.ChannelType.ActiveChannel) {
return chatsModel.channelView.activeChannel
} else if (channelType === GroupInfoPopup.ChannelType.ContextChannel) {
return chatsModel.channelView.contextChannel
}
}
property bool isAdmin: false property bool isAdmin: false
property Component pinnedMessagesPopupComponent property Component pinnedMessagesPopupComponent