Skip to content

Commit

Permalink
Fix wrong event_id being sent for m.in_reply_to of threads
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Mar 2, 2022
1 parent 4e4afdb commit 4d68eb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3718,7 +3718,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
content["m.relates_to"]["m.in_reply_to"] = {
"event_id": thread.lastReply((ev: MatrixEvent) => {
return ev.isThreadRelation && !ev.status;
}),
})?.getId(),
};
}
}
Expand Down Expand Up @@ -3774,7 +3774,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
// then listen for the remote echo of that event so that by the time
// this event does get sent, we have the correct event_id
const targetId = localEvent.getAssociatedId();
if (targetId && targetId.startsWith("~")) {
if (targetId?.startsWith("~")) {
const target = room.getPendingEvents().find(e => e.getId() === targetId);
target.once(MatrixEventEvent.LocalEventIdReplaced, () => {
localEvent.updateAssociatedId(target.getId());
Expand Down

0 comments on commit 4d68eb1

Please sign in to comment.