Skip to content

Commit

Permalink
feat(group): enable updating the group members while sending a message
Browse files Browse the repository at this point in the history
Fixes #8349

When the member selector menu is open, sending a message adds/removes the members and then sends the message. Therefore, the new member will also receive the message.
  • Loading branch information
jrainville committed Dec 30, 2024
1 parent f823c96 commit 0487ddc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 7 additions & 0 deletions ui/app/AppLayouts/Chat/views/ChatColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ Item {
property bool amISectionAdmin: false
property bool sendViaPersonalChatEnabled
property bool paymentRequestFeatureEnabled
property bool selectingMembers

signal openStickerPackPopup(string stickerPackId)
signal tokenPaymentRequested(string recipientAddress, string symbol, string rawAmount, int chainId)
signal groupUpdated()

// This function is called once `1:1` or `group` chat is created.
function checkForCreateChatOptions(chatId) {
Expand Down Expand Up @@ -374,6 +376,11 @@ Item {
return
}

// If the member selector is open, we update the group members and call for the menu to be closed
if (selectingMembers) {
d.activeUsersStore.updateGroupMembers()
root.groupUpdated()
}
if (root.rootStore.sendMessage(d.activeChatContentModule.getMyChatId(),
event,
chatInput.getTextWithPublicKeys(),
Expand Down
17 changes: 10 additions & 7 deletions ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Item {
property var chatContentModule: root.rootStore.currentChatContentModule() || null
property var emojiPopup
property int padding: Theme.halfPadding
readonly property bool selectingMembers: root.state == d.stateMembersSelectorContent

signal searchButtonClicked()
signal displayEditChannelPopup(string chatId,
Expand All @@ -44,13 +45,15 @@ Item {
root.state = d.stateMembersSelectorContent
}

function groupUpdated() {
root.state = d.stateInfoButtonContent
}

QtObject {
id: d

readonly property string stateInfoButtonContent: ""
readonly property string stateMembersSelectorContent: "selectingMembers"

readonly property bool selectingMembers: root.state == stateMembersSelectorContent
}

MessageStore {
Expand All @@ -65,9 +68,9 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: d.selectingMembers ? parent.right : actionButtons.left
anchors.right: root.selectingMembers ? parent.right : actionButtons.left

sourceComponent: d.selectingMembers ? membersSelector : statusChatInfoButton
sourceComponent: root.selectingMembers ? membersSelector : statusChatInfoButton
}

RowLayout {
Expand All @@ -78,7 +81,7 @@ Item {
anchors.right: parent.right

spacing: 8
visible: !d.selectingMembers
visible: !root.selectingMembers

StatusFlatRoundButton {
id: searchButton
Expand Down Expand Up @@ -351,8 +354,8 @@ Item {
}
contactsModel: root.mutualContactsModel

onConfirmed: root.state = d.stateInfoButtonContent
onRejected: root.state = d.stateInfoButtonContent
onConfirmed: root.groupUpdated()
onRejected: root.groupUpdated()
}
}
}
2 changes: 2 additions & 0 deletions ui/app/AppLayouts/Chat/views/ChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ StatusSectionLayout {
amISectionAdmin: root.amISectionAdmin
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
paymentRequestFeatureEnabled: root.paymentRequestFeatureEnabled
selectingMembers: headerContentLoader.item && !!headerContentLoader.item.selectingMembers
onGroupUpdated: headerContentLoader.item && headerContentLoader.item.groupUpdated()
onOpenStickerPackPopup: {
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} )
}
Expand Down

0 comments on commit 0487ddc

Please sign in to comment.