Skip to content

Commit

Permalink
fix: error in setting read until position
Browse files Browse the repository at this point in the history
  • Loading branch information
Silver-IT committed Apr 1, 2024
1 parent e07e1c4 commit a45606a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions frontend/views/containers/chatroom/ChatMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export default ({
},
handleSendMessage (text, attachments, replyingMessage) {
const hasAttachments = attachments?.length > 0
const contractID = this.currentChatRoomId
const contractID = this.renderingChatRoomId
const data = { type: MESSAGE_TYPES.TEXT, text }
if (replyingMessage) {
Expand Down Expand Up @@ -623,7 +623,7 @@ export default ({
editMessage (message, newMessage) {
message.text = newMessage
message.pending = true
const contractID = this.currentChatRoomId
const contractID = this.renderingChatRoomId
sbp('gi.actions/chatroom/editMessage', {
contractID,
data: {
Expand All @@ -636,9 +636,9 @@ export default ({
})
},
deleteMessage (message) {
const contractID = this.currentChatRoomId
const contractID = this.renderingChatRoomId
sbp('gi.actions/chatroom/deleteMessage', {
contractID: this.currentChatRoomId,
contractID,
data: { hash: message.hash }
}).catch((e) => {
console.error(`Error while deleting message for ${contractID}`, e)
Expand All @@ -656,9 +656,9 @@ export default ({
return this.ephemeral.startedUnreadMessageHash === msgHash
},
addEmoticon (message, emoticon) {
const contractID = this.currentChatRoomId
const contractID = this.renderingChatRoomId
sbp('gi.actions/chatroom/makeEmotion', {
contractID: this.currentChatRoomId,
contractID,
data: { hash: message.hash, emoticon }
}).catch((e) => {
console.error(`Error while adding emotion for ${contractID}`, e)
Expand Down Expand Up @@ -858,12 +858,9 @@ export default ({
}
},
updateUnreadMessageHash ({ messageHash, createdDate }) {
if (this.isJoinedChatRoom(this.currentChatRoomId)) {
sbp('state/vuex/commit', 'setChatRoomReadUntil', {
chatRoomId: this.currentChatRoomId,
messageHash,
createdDate
})
const chatRoomId = this.renderingChatRoomId
if (chatRoomId && this.isJoinedChatRoom(chatRoomId)) {
sbp('state/vuex/commit', 'setChatRoomReadUntil', { chatRoomId, messageHash, createdDate })
}
},
listenChatRoomActions (contractID: string, message?: GIMessage) {
Expand Down

0 comments on commit a45606a

Please sign in to comment.