fix: join/decline group

This commit is contained in:
Richard Ramos 2020-09-18 09:11:51 -04:00 committed by Iuri Matias
parent d5f53765b3
commit 2fb8f2ea55
4 changed files with 18 additions and 0 deletions

View File

@ -411,8 +411,11 @@ QtObject:
self.status.chat.join(channel, ChatType(chatTypeInt)) self.status.chat.join(channel, ChatType(chatTypeInt))
self.setActiveChannel(channel) self.setActiveChannel(channel)
proc chatGroupJoined(self: ChatsView) {.signal.}
proc joinGroup*(self: ChatsView) {.slot.} = proc joinGroup*(self: ChatsView) {.slot.} =
self.status.chat.confirmJoiningGroup(self.activeChannel.id) self.status.chat.confirmJoiningGroup(self.activeChannel.id)
self.chatGroupJoined()
proc messagesLoaded*(self: ChatsView) {.signal.} proc messagesLoaded*(self: ChatsView) {.signal.}

View File

@ -20,6 +20,13 @@ Rectangle {
property bool paste: false; property bool paste: false;
property bool isColonPressed: false; property bool isColonPressed: false;
Connections {
target: chatsModel
onChatGroupJoined: {
rectangle.visible = true;
}
}
Audio { Audio {
id: sendMessageSound id: sendMessageSound
source: "../../../../sounds/send_message.wav" source: "../../../../sounds/send_message.wav"

View File

@ -110,6 +110,11 @@ Item {
Component { Component {
id: fetchMoreMessagesButtonComponent id: fetchMoreMessagesButtonComponent
Item { Item {
visible: {
if(chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat) return true;
return chatsModel.activeChannel.isMember(profileModel.profile.pubKey)
}
id: wrapper id: wrapper
height: wrapper.visible ? fetchMoreButton.height + fetchDate.height + 3 + Style.current.smallPadding*2 : 0 height: wrapper.visible ? fetchMoreButton.height + fetchDate.height + 3 + Style.current.smallPadding*2 : 0
anchors.left: parent.left anchors.left: parent.left

View File

@ -101,6 +101,8 @@ Item {
visible: chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat && !chatsModel.activeChannel.isMember(profileModel.profile.pubKey) visible: chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat && !chatsModel.activeChannel.isMember(profileModel.profile.pubKey)
anchors.top: channelDescription.bottom anchors.top: channelDescription.bottom
anchors.topMargin: 16 anchors.topMargin: 16
anchors.horizontalCenter: parent.horizontalCenter
height: visible ? 100 : 10
id: joinOrDecline id: joinOrDecline
StyledText { StyledText {
@ -116,6 +118,7 @@ Item {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
chatsModel.joinGroup() chatsModel.joinGroup()
joinOrDecline.visible = false;
} }
} }
} }