Merge remote-tracking branch 'origin/develop' into develop
commit
d8dbc316fa
|
@ -38,18 +38,20 @@ function memberEventDiff(ev) {
|
|||
}
|
||||
|
||||
export default function shouldHideEvent(ev) {
|
||||
// Wrap getValue() for readability
|
||||
// Wrap getValue() for readability. Calling the SettingsStore can be
|
||||
// fairly resource heavy, so the checks below should avoid hitting it
|
||||
// where possible.
|
||||
const isEnabled = (name) => SettingsStore.getValue(name, ev.getRoomId());
|
||||
|
||||
// Hide redacted events
|
||||
if (isEnabled('hideRedactions') && ev.isRedacted()) return true;
|
||||
if (ev.isRedacted() && isEnabled('hideRedactions')) return true;
|
||||
|
||||
const eventDiff = memberEventDiff(ev);
|
||||
|
||||
if (eventDiff.isMemberEvent) {
|
||||
if (isEnabled('hideJoinLeaves') && (eventDiff.isJoin || eventDiff.isPart)) return true;
|
||||
if (isEnabled('hideAvatarChanges') && eventDiff.isAvatarChange) return true;
|
||||
if (isEnabled('hideDisplaynameChanges') && eventDiff.isDisplaynameChange) return true;
|
||||
if ((eventDiff.isJoin || eventDiff.isPart) && isEnabled('hideJoinLeaves')) return true;
|
||||
if (eventDiff.isAvatarChange && isEnabled('hideAvatarChanges')) return true;
|
||||
if (eventDiff.isDisplaynameChange && isEnabled('hideDisplaynameChanges')) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue