mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 18:25:49 +03:00
Use textForEvent to determine if an event is worth rendering
This commit is contained in:
parent
d95f843cd0
commit
b06a82ee80
1 changed files with 6 additions and 9 deletions
|
@ -28,6 +28,7 @@ import {MatrixClientPeg} from '../../MatrixClientPeg';
|
|||
import SettingsStore from '../../settings/SettingsStore';
|
||||
import {_t} from "../../languageHandler";
|
||||
import {haveTileForEvent} from "../views/rooms/EventTile";
|
||||
import {textForEvent} from "../../TextForEvent";
|
||||
|
||||
const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes
|
||||
const continuedTypes = ['m.sticker', 'm.room.message'];
|
||||
|
@ -963,15 +964,11 @@ class MemberGrouper {
|
|||
|
||||
add(ev) {
|
||||
if (ev.getType() === 'm.room.member') {
|
||||
// We'll just double check that it's worth our time to do so...
|
||||
if (ev.getPrevContent()) {
|
||||
const membershipChange = ev.getPrevContent()['membership'] !== ev.getContent()['membership'];
|
||||
const displayNameChange = ev.getPrevContent()['displayname'] !== ev.getContent()['displayname'];
|
||||
const avatarChange = ev.getPrevContent()['avatar_url'] !== ev.getContent()['avatar_url'];
|
||||
if (!membershipChange && !displayNameChange && !avatarChange) {
|
||||
return; // Not a substantial change - quietly ignore
|
||||
}
|
||||
}
|
||||
// We'll just double check that it's worth our time to do so, through an
|
||||
// ugly hack. If textForEvent returns something, we should group it for
|
||||
// rendering but if it doesn't then we'll exclude it.
|
||||
const renderText = textForEvent(ev);
|
||||
if (!renderText || renderText.trim().length === 0) return; // quietly ignore
|
||||
}
|
||||
this.readMarker = this.readMarker || this.panel._readMarkerForEvent(ev.getId());
|
||||
this.events.push(ev);
|
||||
|
|
Loading…
Reference in a new issue