mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-12 17:01:10 +03:00
Merge pull request #4447 from matrix-org/t3chguy/poljar/cherry-pick1
EventIndex: Filter out events that don't have a propper content value.
This commit is contained in:
commit
54c1ae8322
1 changed files with 8 additions and 1 deletions
|
@ -275,6 +275,7 @@ export default class EventIndex extends EventEmitter {
|
||||||
const validEventType = isUsefulType && !ev.isRedacted() && !ev.isDecryptionFailure();
|
const validEventType = isUsefulType && !ev.isRedacted() && !ev.isDecryptionFailure();
|
||||||
|
|
||||||
let validMsgType = true;
|
let validMsgType = true;
|
||||||
|
let hasContentValue = true;
|
||||||
|
|
||||||
if (ev.getType() === "m.room.message" && !ev.isRedacted()) {
|
if (ev.getType() === "m.room.message" && !ev.isRedacted()) {
|
||||||
// Expand this if there are more invalid msgtypes.
|
// Expand this if there are more invalid msgtypes.
|
||||||
|
@ -282,9 +283,15 @@ export default class EventIndex extends EventEmitter {
|
||||||
|
|
||||||
if (!msgtype) validMsgType = false;
|
if (!msgtype) validMsgType = false;
|
||||||
else validMsgType = !msgtype.startsWith("m.key.verification");
|
else validMsgType = !msgtype.startsWith("m.key.verification");
|
||||||
|
|
||||||
|
if (!ev.getContent().body) hasContentValue = false;
|
||||||
|
} else if (ev.getType() === "m.room.topic" && !ev.isRedacted()) {
|
||||||
|
if (!ev.getContent().topic) hasContentValue = false;
|
||||||
|
} else if (ev.getType() === "m.room.name" && !ev.isRedacted()) {
|
||||||
|
if (!ev.getContent().name) hasContentValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return validEventType && validMsgType;
|
return validEventType && validMsgType && hasContentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue