Merge pull request #6280 from robintown/group-acls

Group ACLs with MELS
This commit is contained in:
J. Ryan Stinnett 2021-06-29 10:02:12 +01:00 committed by GitHub
commit 14ef38e057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {