зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #7061 from nextcloud/bugfix/noid/fix-user-has-reacted
Fix detection if the user (not author) reacted already
This commit is contained in:
Коммит
95001fd9a5
|
@ -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', {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
},
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче