hide server ACL events from timeline by default, introduce setting to show them
This commit is contained in:
parent
0743c4cfc6
commit
9e6951818a
3 changed files with 25 additions and 4 deletions
|
|
@ -230,6 +230,21 @@ class SettingsSectionsController
|
||||||
.onError(showError),
|
.onError(showError),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
.new(
|
||||||
|
title: "Hide Server ACL Events",
|
||||||
|
description: "Hides server ACL (server ban list) changes from appearing in conversations.",
|
||||||
|
icon: Icons.dns,
|
||||||
|
builder: (title, description, icon) => SwitchListTile(
|
||||||
|
title: Text(title),
|
||||||
|
subtitle: Text(description),
|
||||||
|
secondary: Icon(icon),
|
||||||
|
value: settings.hideServerAclEvents,
|
||||||
|
onChanged: (value) => ref
|
||||||
|
.read(SettingsController.provider.notifier)
|
||||||
|
.set(settings.copyWith(hideServerAclEvents: value))
|
||||||
|
.onError(showError),
|
||||||
|
),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
.new(
|
.new(
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class const Settings({
|
||||||
final bool showMinimizeButton = false,
|
final bool showMinimizeButton = false,
|
||||||
final bool swipeToReply = false,
|
final bool swipeToReply = false,
|
||||||
final bool hideMembershipEvents = false,
|
final bool hideMembershipEvents = false,
|
||||||
|
final bool hideServerAclEvents = true,
|
||||||
final RoomOrder roomOrder = .unreadFirst,
|
final RoomOrder roomOrder = .unreadFirst,
|
||||||
final NameColor nameColor = .powerLevel,
|
final NameColor nameColor = .powerLevel,
|
||||||
final ShowAndSend typingIndicators = .showAndSend,
|
final ShowAndSend typingIndicators = .showAndSend,
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,13 @@ class const EventRenderer(
|
||||||
|
|
||||||
if (event == null) return SizedBox.shrink();
|
if (event == null) return SizedBox.shrink();
|
||||||
|
|
||||||
final hideMembershipEvents = (ref
|
final (hideMembershipEvents, hideServerAclEvents) = ref
|
||||||
.watch(SettingsController.provider)
|
.watch(SettingsController.provider)
|
||||||
.maybeWhen(
|
.maybeWhen(
|
||||||
orElse: () => false,
|
orElse: () => (false, true),
|
||||||
data: (settings) => settings.hideMembershipEvents,
|
data: (settings) =>
|
||||||
));
|
(settings.hideMembershipEvents, settings.hideServerAclEvents),
|
||||||
|
);
|
||||||
|
|
||||||
// Knocks and their outcomes stay visible, as moderators need to act on them
|
// Knocks and their outcomes stay visible, as moderators need to act on them
|
||||||
if (hideMembershipEvents &&
|
if (hideMembershipEvents &&
|
||||||
|
|
@ -106,6 +107,10 @@ class const EventRenderer(
|
||||||
return SizedBox.shrink();
|
return SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hideServerAclEvents && event.content is ServerACLContent) {
|
||||||
|
return SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
final isGrouped =
|
final isGrouped =
|
||||||
(previousEvent?.isShownAsMessage ?? false) &&
|
(previousEvent?.isShownAsMessage ?? false) &&
|
||||||
event.sender == previousEvent?.sender &&
|
event.sender == previousEvent?.sender &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue