add power level room settings
This commit is contained in:
parent
fcfe4eed1e
commit
b0dd452926
2 changed files with 944 additions and 179 deletions
|
|
@ -10,7 +10,7 @@ sealed class PowerLevelsContent extends Content with _$PowerLevelsContent {
|
|||
factory PowerLevelsContent({
|
||||
@Default(IMap.empty()) IMap<String, int> events,
|
||||
@Default(IMap.empty()) IMap<String, int> users,
|
||||
Notifications? notifications,
|
||||
@JsonKey(includeIfNull: false) Notifications? notifications,
|
||||
@Default(50) int ban,
|
||||
@Default(0) int eventsDefault,
|
||||
@Default(0) int invite,
|
||||
|
|
|
|||
11
lib/models/room_power_levels.dart
Normal file
11
lib/models/room_power_levels.dart
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:nexus/models/content/power_levels.dart";
|
||||
|
||||
class const RoomPowerLevels({
|
||||
required final PowerLevelsContent content,
|
||||
final ISet<String> creators = const .empty(),
|
||||
}) {
|
||||
double levelOf(String userId) => creators.contains(userId)
|
||||
? double.infinity
|
||||
: (content.users[userId] ?? content.usersDefault).toDouble();
|
||||
}
|
||||
Loading…
Reference in a new issue