Skip to content

Commit

Permalink
Fix(Reactions): add dynamic order by count
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
  • Loading branch information
DorraJaouad committed Dec 31, 2023
1 parent 79baf73 commit b62334b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<template>
<!-- reactions buttons and popover with details -->
<div class="reactions-wrapper">
<NcPopover v-for="reaction in Object.keys(detailedReactions ?? plainReactions)"
<NcPopover v-for="reaction in reactionsSorted"
:key="reaction"
:delay="200"
:focus-trap="false"
Expand Down Expand Up @@ -136,6 +136,14 @@ export default {
return this.$store.getters.message(this.token, this.id).reactionsSelf
},
reactionsSorted() {
return this.detailedReactions
? Object.keys(this.detailedReactions)
.sort((a, b) => this.detailedReactions[b].length - this.detailedReactions[a].length)
: Object.keys(this.plainReactions)
.sort((a, b) => this.plainReactions[b] - this.plainReactions[a])
},
/**
* Whether the plain reactions are different from the detailed ones.
*/
Expand Down

0 comments on commit b62334b

Please sign in to comment.