Emojis update realtime

This commit is contained in:
10G Meow 2022-06-08 14:13:40 +00:00 committed by n8fr8
parent b338b84f64
commit 90daf060cc
6 changed files with 14 additions and 13 deletions

View file

@ -72,7 +72,6 @@
:room="room" :room="room"
:event="event" :event="event"
:nextEvent="events[index + 1]" :nextEvent="events[index + 1]"
:reactions="timelineSet.getRelationsForEvent(event.getId(), 'm.annotation', 'm.reaction')"
:timelineSet="timelineSet" :timelineSet="timelineSet"
v-on:send-quick-reaction="sendQuickReaction" v-on:send-quick-reaction="sendQuickReaction"
v-on:context-menu="showContextMenuForEvent($event)" v-on:context-menu="showContextMenuForEvent($event)"

View file

@ -33,7 +33,6 @@
:room="room" :room="room"
:event="event" :event="event"
:nextEvent="events[index + 1]" :nextEvent="events[index + 1]"
:reactions="timelineSet.getRelationsForEvent(event.getId(), 'm.annotation', 'm.reaction')"
:timelineSet="timelineSet" :timelineSet="timelineSet"
ref="exportedEvent" ref="exportedEvent"
/> />

View file

@ -20,7 +20,7 @@
><v-icon>more_vert</v-icon></v-btn ><v-icon>more_vert</v-icon></v-btn
> >
</div> </div>
<QuickReactions :event="event" :reactions="reactions" /> <QuickReactions :event="event" :timelineSet="timelineSet" />
</div> </div>
</template> </template>

View file

@ -8,7 +8,7 @@
<div class="status">{{ event.status }}</div> <div class="status">{{ event.status }}</div>
</div> </div>
<QuickReactions :event="event" :reactions="reactions" /> <QuickReactions :event="event" :timelineSet="timelineSet" />
<div class="op-button" ref="opbutton"> <div class="op-button" ref="opbutton">
<v-btn id="btn-show-menu" icon @click.stop="showContextMenu($refs.opbutton)" <v-btn id="btn-show-menu" icon @click.stop="showContextMenu($refs.opbutton)"
><v-icon>more_vert</v-icon></v-btn ><v-icon>more_vert</v-icon></v-btn

View file

@ -15,24 +15,33 @@ export default {
return {} return {}
} }
}, },
reactions: { timelineSet: {
type: Object, type: Object,
default: function () { default: function () {
return null return null
} }
} },
}, },
data() { data() {
return { return {
reactionMap: {} reactionMap: {},
reactions: null
} }
}, },
mounted() {
this.reactions = this.timelineSet.getRelationsForEvent(this.event.getId(), 'm.annotation', 'm.reaction');
this.event.on("Event.relationsCreated", this.onRelationsCreated);
},
beforeDestroy() { beforeDestroy() {
this.event.off("Event.relationsCreated", this.onRelationsCreated);
if (this.reactions) { if (this.reactions) {
this.reactions.off('Relations.add', this.onAddRelation); this.reactions.off('Relations.add', this.onAddRelation);
} }
}, },
methods: { methods: {
onRelationsCreated() {
this.reactions = this.timelineSet.getRelationsForEvent(this.event.getId(), 'm.annotation', 'm.reaction');
},
onClickEmoji(emoji) { onClickEmoji(emoji) {
this.$bubble('send-quick-reaction', {reaction:emoji, event:this.event}); this.$bubble('send-quick-reaction', {reaction:emoji, event:this.event});
}, },

View file

@ -27,12 +27,6 @@ export default {
return null return null
} }
}, },
reactions: {
type: Object,
default: function () {
return null
}
},
timelineSet: { timelineSet: {
type: Object, type: Object,
default: function () { default: function () {