Skip to content

Commit

Permalink
fix the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SebinSong committed Jan 15, 2025
1 parent 0486f23 commit 9623df0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/views/components/ProfileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ export default ({
async sendMessage () {
const chatRoomID = this.ourGroupDirectMessageFromUserIds(this.contractID)
if (!chatRoomID) {
await this.createDirectMessage(this.contractID)
const dmChatRoomId = await this.createDirectMessage(this.contractID)
if (dmChatRoomId) {
this.redirect(dmChatRoomId)
}
} 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 9623df0

Please sign in to comment.