Fix event list summaries including invalid events (#9041)

pull/28217/head
Michael Telatynski 2022-07-11 16:25:11 +01:00 committed by GitHub
parent 7f07443161
commit 0bc2f1c101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -60,7 +60,7 @@ import { hasThreadSummary } from "../../utils/EventUtils";
const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes
const continuedTypes = [EventType.Sticker, EventType.RoomMessage]; const continuedTypes = [EventType.Sticker, EventType.RoomMessage];
const groupedEvents = [ const groupedStateEvents = [
EventType.RoomMember, EventType.RoomMember,
EventType.RoomThirdPartyInvite, EventType.RoomThirdPartyInvite,
EventType.RoomServerAcl, EventType.RoomServerAcl,
@ -1190,7 +1190,7 @@ class MainGrouper extends BaseGrouper {
static canStartGroup = function(panel: MessagePanel, ev: MatrixEvent): boolean { static canStartGroup = function(panel: MessagePanel, ev: MatrixEvent): boolean {
if (!panel.shouldShowEvent(ev)) return false; if (!panel.shouldShowEvent(ev)) return false;
if (groupedEvents.includes(ev.getType() as EventType)) { if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) {
return true; return true;
} }
@ -1225,7 +1225,7 @@ class MainGrouper extends BaseGrouper {
if (this.panel.wantsDateSeparator(this.events[0], ev.getDate())) { if (this.panel.wantsDateSeparator(this.events[0], ev.getDate())) {
return false; return false;
} }
if (groupedEvents.includes(ev.getType() as EventType)) { if (ev.isState() && groupedStateEvents.includes(ev.getType() as EventType)) {
return true; return true;
} }
if (ev.isRedacted()) { if (ev.isRedacted()) {

View File

@ -19,6 +19,7 @@ import * as utils from "matrix-js-sdk/src/utils";
import { Room } from "matrix-js-sdk/src/models/room"; import { Room } from "matrix-js-sdk/src/models/room";
import { logger } from "matrix-js-sdk/src/logger"; import { logger } from "matrix-js-sdk/src/logger";
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state"; import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { MatrixClientPeg } from "../../MatrixClientPeg"; import { MatrixClientPeg } from "../../MatrixClientPeg";
import MatrixToPermalinkConstructor, { baseUrl as matrixtoBaseUrl } from "./MatrixToPermalinkConstructor"; import MatrixToPermalinkConstructor, { baseUrl as matrixtoBaseUrl } from "./MatrixToPermalinkConstructor";
@ -211,7 +212,7 @@ export class RoomPermalinkCreator {
const bannedHostsRegexps = []; const bannedHostsRegexps = [];
let allowedHostsRegexps = [ANY_REGEX]; // default allow everyone let allowedHostsRegexps = [ANY_REGEX]; // default allow everyone
if (this.room.currentState) { if (this.room.currentState) {
const aclEvent = this.room.currentState.getStateEvents("m.room.server_acl", ""); const aclEvent = this.room.currentState.getStateEvents(EventType.RoomServerAcl, "");
if (aclEvent && aclEvent.getContent()) { if (aclEvent && aclEvent.getContent()) {
const getRegex = (hostname) => new RegExp("^" + utils.globToRegexp(hostname, false) + "$"); const getRegex = (hostname) => new RegExp("^" + utils.globToRegexp(hostname, false) + "$");