Skip to content

Commit

Permalink
Log message ID for undecryptable to-device messages
Browse files Browse the repository at this point in the history
... to help with debugging.
  • Loading branch information
richvdh committed Jul 5, 2023
1 parent 5751df1 commit 92ace50
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/models/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
EventType,
MsgType,
RelationType,
ToDeviceMessageId,
UNSIGNED_THREAD_ID_FIELD,
} from "../@types/event";
import { Crypto } from "../crypto";
Expand Down Expand Up @@ -517,16 +518,15 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
* ```
*/
public getDetails(): string {
let details = `id=${this.getId()} type=${this.getWireType()} sender=${this.getSender()}`;
const room = this.getRoomId();
if (room) {
details += ` room=${room}`;
}
const date = this.getDate();
if (date) {
details += ` ts=${date.toISOString()}`;
// in-room event
return `id=${this.getId()} type=${this.getWireType()} sender=${this.getSender()} room=${room} ts=${this.getDate()?.toISOString()}`;
} else {
// to-device event
const msgid = this.getContent()[ToDeviceMessageId];
return `msgid=${msgid} type=${this.getWireType()} sender=${this.getSender()}`;
}
return details;
}

/**
Expand Down

0 comments on commit 92ace50

Please sign in to comment.