Merge pull request #4868 from matrix-org/travis/room-list/preview-crash
Fix reaction event crashes in message previews
This commit is contained in:
commit
dc182b9012
1 changed files with 5 additions and 2 deletions
|
@ -22,8 +22,11 @@ import { _t } from "../../../languageHandler";
|
||||||
|
|
||||||
export class ReactionEventPreview implements IPreview {
|
export class ReactionEventPreview implements IPreview {
|
||||||
public getTextFor(event: MatrixEvent, tagId?: TagID): string {
|
public getTextFor(event: MatrixEvent, tagId?: TagID): string {
|
||||||
const reaction = event.getRelation().key;
|
const relation = event.getRelation();
|
||||||
if (!reaction) return;
|
if (!relation) return null; // invalid reaction (probably redacted)
|
||||||
|
|
||||||
|
const reaction = relation.key;
|
||||||
|
if (!reaction) return null; // invalid reaction (unknown format)
|
||||||
|
|
||||||
if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) {
|
if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) {
|
||||||
return reaction;
|
return reaction;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue