Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ export default {
await this.getReactions()
}
// Check if current user has already added this reaction to the message
const currentUserHasReacted = this.$store.getters.userHasReacted(this.actorId, this.token, this.id, clickedEmoji)
const currentUserHasReacted = this.$store.getters.userHasReacted(this.$store.getters.getActorType(), this.$store.getters.getActorId(), this.token, this.id, clickedEmoji)

if (!currentUserHasReacted) {
this.$store.dispatch('addReactionToMessage', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export default {

handleReactionClick(selectedEmoji) {
// Add reaction only if user hasn't reacted yet
if (!this.$store.getters.userHasReacted(this.actorId, this.token, this.messageObject.id, selectedEmoji)) {
if (!this.$store.getters.userHasReacted(this.$store.getters.getActorType(), this.$store.getters.getActorId(), this.token, this.messageObject.id, selectedEmoji)) {
this.$store.dispatch('addReactionToMessage', {
token: this.token,
messageId: this.messageObject.id,
Expand Down
4 changes: 2 additions & 2 deletions src/store/reactionsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const getters = {
},

// Checks if a user has already reacted to a message with a particular reaction
userHasReacted: (state) => (actorId, token, messageId, reaction) => {
userHasReacted: (state) => (actorType, actorId, token, messageId, reaction) => {
if (!state?.reactions?.[token]?.[messageId]?.[reaction]) {
return false
}
return state?.reactions?.[token]?.[messageId]?.[reaction].filter(item => {
return item.actorId === actorId
return item.actorType === actorType && item.actorId === actorId
}).length !== 0
},
}
Expand Down