Skip to content

Commit

Permalink
#2506 - Fix the redirection bug on Send Message button. (#2509)
Browse files Browse the repository at this point in the history
* fix the bug

* update the variable name

* fix #2510

* variable update again
  • Loading branch information
SebinSong authored Jan 15, 2025
1 parent 307baf6 commit fd5aea7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions frontend/views/components/ProfileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,15 @@ export default ({
)
},
toggleTooltip () {
this.$refs.tooltip.toggle()
this.$refs.tooltip?.toggle()
},
async sendMessage () {
const chatRoomID = this.ourGroupDirectMessageFromUserIds(this.contractID)
if (!chatRoomID) {
await this.createDirectMessage(this.contractID)
const freshChatRoomID = await this.createDirectMessage(this.contractID)
if (freshChatRoomID) {
this.redirect(freshChatRoomID)
}
} else {
if (!this.ourGroupDirectMessages[chatRoomID].visible) {
this.setDMVisibility(chatRoomID, true)
Expand Down
7 changes: 6 additions & 1 deletion frontend/views/containers/chatroom/DMMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const DMMixin: Object = {
try {
const identityContractID = this.ourIdentityContractId
const currentGroupId = this.currentGroupId
let dmChatRoomId

await sbp('gi.actions/identity/createDirectMessage', {
contractID: identityContractID,
data: { currentGroupId, memberIDs },
Expand All @@ -33,10 +35,13 @@ const DMMixin: Object = {
// state ('pending') and we'll set the chatroom ID when the
// contract is loaded.
// This is done in the JOINED_CHATROOM event.
sbp('state/vuex/commit', 'setPendingChatRoomId', { chatRoomID: message.contractID(), groupID: currentGroupId })
dmChatRoomId = message.contractID()
sbp('state/vuex/commit', 'setPendingChatRoomId', { chatRoomID: dmChatRoomId, groupID: currentGroupId })
}
}
})

return dmChatRoomId
} catch (err) {
console.error('[DMMixin.js] Failed to create a new chatroom', err)
await sbp('gi.ui/prompt', {
Expand Down

0 comments on commit fd5aea7

Please sign in to comment.