Skip to content

Commit

Permalink
Reaction list --> array remove added.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminDreasond committed Dec 26, 2024
1 parent 9b1b9c0 commit 0cada16
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client/state/RoomTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class RoomTimeline extends EventEmitter {
_timelineUpdated(eventType, mEvent) {
console.log(
`${this._consoleTag} [${eventType}]${mEvent ? ` [${mEvent.getType()}]` : ''} Timeline updated!`,
mEvent,
);
}

Expand Down Expand Up @@ -506,7 +505,7 @@ class RoomTimeline extends EventEmitter {
if (relateToId === null) return { mEvents: null, mEventId: null, tsId: null };
if (!this.reactionTimeline.has(relateToId)) this.reactionTimeline.set(relateToId, []);
const mEvents = this.reactionTimeline.get(relateToId);
return { mEvents, tsId: `${relateToId}:${mEvent.getId()}` };
return { mEvents, relateToId, tsId: `${relateToId}:${mEvent.getId()}` };
}

_insertReaction(mEvent) {
Expand All @@ -530,7 +529,7 @@ class RoomTimeline extends EventEmitter {
_removeReaction(mEvent) {
const isRedacted = mEvent.isRedacted();
if (isRedacted) {
const { mEvents, tsId } = this._getReactionTimeline(mEvent);
const { mEvents, relateToId, tsId } = this._getReactionTimeline(mEvent);
const ts = mEvent.getTs();
if (
mEvents &&
Expand All @@ -541,6 +540,8 @@ class RoomTimeline extends EventEmitter {
mEvent.forceRedaction();
console.log(`${this._consoleTag} Reaction removed: ${mEvent.getId()}`, ts);
mEvents.splice(index, 1);
if (mEvents.length < 1) this.reactionTimeline.delete(relateToId);

this.reactionTimelineTs[tsId] = ts;
this.emit(cons.events.roomTimeline.EVENT_REDACTED, mEvent);
}
Expand Down Expand Up @@ -717,6 +718,8 @@ class RoomTimeline extends EventEmitter {
if (index > -1) {
const rEvent = mEvents[index];
mEvents.splice(index, 1);
if (mEvents.length < 1) this.reactionTimeline.delete(relateToId);

const ts = rEvent.getTs();
rEvent.forceRedaction();
console.log(`${this._consoleTag} Reaction removed: ${redacts}`, ts);
Expand Down

0 comments on commit 0cada16

Please sign in to comment.