Group ACLs with MELS

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin Townsend 2021-06-28 12:32:38 -04:00
parent a8f5b7ebae
commit a11193e243
3 changed files with 24 additions and 6 deletions

View file

@ -38,6 +38,7 @@ import defaultDispatcher from '../../dispatcher/dispatcher';
const CONTINUATION_MAX_INTERVAL = 5 * 60 * 1000; // 5 minutes
const continuedTypes = ['m.sticker', 'm.room.message'];
const membershipTypes = ['m.room.member', 'm.room.third_party_invite', 'm.room.server_acl'];
// check if there is a previous event and it has the same sender as this event
// and the types are the same/is in continuedTypes and the time between them is <= CONTINUATION_MAX_INTERVAL
@ -66,8 +67,6 @@ function shouldFormContinuation(prevEvent, mxEvent) {
return true;
}
const isMembershipChange = (e) => e.getType() === 'm.room.member' || e.getType() === 'm.room.third_party_invite';
/* (almost) stateless UI component which builds the event tiles in the room timeline.
*/
@replaceableComponent("structures.MessagePanel")
@ -1144,7 +1143,7 @@ class RedactionGrouper {
// Wrap consecutive member events in a ListSummary, ignore if redacted
class MemberGrouper {
static canStartGroup = function(panel, ev) {
return panel._shouldShowEvent(ev) && isMembershipChange(ev);
return panel._shouldShowEvent(ev) && membershipTypes.includes(ev.getType());
}
constructor(panel, ev, prevEvent, lastShownEvent) {
@ -1162,7 +1161,7 @@ class MemberGrouper {
if (this.panel._wantsDateSeparator(this.events[0], ev.getDate())) {
return false;
}
return isMembershipChange(ev);
return membershipTypes.includes(ev.getType());
}
add(ev) {