Hide some Chat permission options

pull/1384/head
Kelrap 1 year ago
parent 8fba3b667e
commit 59e521b69e

@ -35,11 +35,26 @@ class ChatPermissionsSettingsView extends StatelessWidget {
final powerLevels = Map<String, dynamic>.from(powerLevelsContent) final powerLevels = Map<String, dynamic>.from(powerLevelsContent)
// #Pangea // #Pangea
// ..removeWhere((k, v) => v is! int); // ..removeWhere((k, v) => v is! int);
..removeWhere((k, v) => v is! int || k.equals("m.call.invite")); ..removeWhere(
(k, v) =>
v is! int ||
k.equals("m.call.invite") ||
k.equals("historical") ||
k.equals("state_default"),
);
// Pangea# // Pangea#
final eventsPowerLevels = Map<String, int?>.from( final eventsPowerLevels = Map<String, int?>.from(
powerLevelsContent.tryGetMap<String, int?>('events') ?? {}, powerLevelsContent.tryGetMap<String, int?>('events') ?? {},
)..removeWhere((k, v) => v is! int); // #Pangea
)..removeWhere(
(k, v) =>
v is! int ||
k.equals("m.space.child") ||
k.equals("pangea.usranalytics") ||
k.equals(EventTypes.RoomPowerLevels),
);
// )..removeWhere((k, v) => v is! int);
// Pangea#
return Column( return Column(
children: [ children: [
Column( Column(
@ -57,51 +72,59 @@ class ChatPermissionsSettingsView extends StatelessWidget {
), ),
canEdit: room.canChangePowerLevel, canEdit: room.canChangePowerLevel,
), ),
Divider(color: Theme.of(context).dividerColor), // #Pangea
ListTile( // Why would teacher need to stop students from seeing notifications?
title: Text( // Divider(color: Theme.of(context).dividerColor),
L10n.of(context)!.notifications, // ListTile(
style: TextStyle( // title: Text(
color: Theme.of(context).colorScheme.primary, // L10n.of(context)!.notifications,
fontWeight: FontWeight.bold, // style: TextStyle(
), // color: Theme.of(context).colorScheme.primary,
), // fontWeight: FontWeight.bold,
), // ),
Builder( // ),
builder: (context) { // ),
const key = 'rooms'; // Builder(
final value = powerLevelsContent // builder: (context) {
.containsKey('notifications') // const key = 'rooms';
? powerLevelsContent // final value = powerLevelsContent
.tryGetMap<String, Object?>('notifications') // .containsKey('notifications')
?.tryGet<int>('rooms') ?? // ? powerLevelsContent
0 // .tryGetMap<String, Object?>('notifications')
: 0; // ?.tryGet<int>('rooms') ??
return PermissionsListTile( // 0
permissionKey: key, // : 0;
permission: value, // return PermissionsListTile(
category: 'notifications', // permissionKey: key,
canEdit: room.canChangePowerLevel, // permission: value,
onChanged: (level) => controller.editPowerLevel( // category: 'notifications',
context, // canEdit: room.canChangePowerLevel,
key, // onChanged: (level) => controller.editPowerLevel(
value, // context,
newLevel: level, // key,
category: 'notifications', // value,
// newLevel: level,
// category: 'notifications',
// ),
// );
// },
// ),
// Only show if there are actually items in this category
if (eventsPowerLevels.isNotEmpty)
// Pangea#
Divider(color: Theme.of(context).dividerColor),
// #Pangea
if (eventsPowerLevels.isNotEmpty)
// Pangea#
ListTile(
title: Text(
L10n.of(context)!.configureChat,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
), ),
);
},
),
Divider(color: Theme.of(context).dividerColor),
ListTile(
title: Text(
L10n.of(context)!.configureChat,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
), ),
), ),
),
for (final entry in eventsPowerLevels.entries) for (final entry in eventsPowerLevels.entries)
PermissionsListTile( PermissionsListTile(
permissionKey: entry.key, permissionKey: entry.key,

@ -109,7 +109,7 @@ class SubscriptionCard extends StatelessWidget {
title ?? subscription?.displayName(context) ?? '', title ?? subscription?.displayName(context) ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 20,
color: color:
enabled ? null : const Color.fromARGB(255, 174, 174, 174), enabled ? null : const Color.fromARGB(255, 174, 174, 174),
), ),

Loading…
Cancel
Save