Add room moderation feature flag (#2495)
This commit is contained in:
parent
6a75be7bf0
commit
3e56420648
6 changed files with 16 additions and 4 deletions
|
|
@ -80,6 +80,10 @@ class RoomDetailsPresenter @Inject constructor(
|
||||||
val roomTopic by remember { derivedStateOf { roomInfo?.topic ?: room.topic } }
|
val roomTopic by remember { derivedStateOf { roomInfo?.topic ?: room.topic } }
|
||||||
val isFavorite by remember { derivedStateOf { roomInfo?.isFavorite.orFalse() } }
|
val isFavorite by remember { derivedStateOf { roomInfo?.isFavorite.orFalse() } }
|
||||||
|
|
||||||
|
val isRoomModerationEnabled by produceState(initialValue = false) {
|
||||||
|
value = featureFlagService.isFeatureEnabled(FeatureFlags.RoomModeration)
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
canShowNotificationSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.NotificationSettings)
|
canShowNotificationSettings.value = featureFlagService.isFeatureEnabled(FeatureFlags.NotificationSettings)
|
||||||
if (canShowNotificationSettings.value) {
|
if (canShowNotificationSettings.value) {
|
||||||
|
|
@ -152,7 +156,7 @@ class RoomDetailsPresenter @Inject constructor(
|
||||||
leaveRoomState = leaveRoomState,
|
leaveRoomState = leaveRoomState,
|
||||||
roomNotificationSettings = roomNotificationSettingsState.roomNotificationSettings(),
|
roomNotificationSettings = roomNotificationSettingsState.roomNotificationSettings(),
|
||||||
isFavorite = isFavorite,
|
isFavorite = isFavorite,
|
||||||
displayAdminSettings = !room.isDm && isUserAdmin,
|
displayRolesAndPermissionsSettings = isRoomModerationEnabled && !room.isDm && isUserAdmin,
|
||||||
eventSink = ::handleEvents,
|
eventSink = ::handleEvents,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ data class RoomDetailsState(
|
||||||
val leaveRoomState: LeaveRoomState,
|
val leaveRoomState: LeaveRoomState,
|
||||||
val roomNotificationSettings: RoomNotificationSettings?,
|
val roomNotificationSettings: RoomNotificationSettings?,
|
||||||
val isFavorite: Boolean,
|
val isFavorite: Boolean,
|
||||||
val displayAdminSettings: Boolean,
|
val displayRolesAndPermissionsSettings: Boolean,
|
||||||
val eventSink: (RoomDetailsEvent) -> Unit
|
val eventSink: (RoomDetailsEvent) -> Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ fun aRoomDetailsState(
|
||||||
leaveRoomState = leaveRoomState,
|
leaveRoomState = leaveRoomState,
|
||||||
roomNotificationSettings = roomNotificationSettings,
|
roomNotificationSettings = roomNotificationSettings,
|
||||||
isFavorite = isFavorite,
|
isFavorite = isFavorite,
|
||||||
displayAdminSettings = displayAdminSettings,
|
displayRolesAndPermissionsSettings = displayAdminSettings,
|
||||||
eventSink = eventSink
|
eventSink = eventSink
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ fun RoomDetailsView(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (state.displayAdminSettings) {
|
if (state.displayRolesAndPermissionsSettings) {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text("Roles and permissions") },
|
headlineContent = { Text("Roles and permissions") },
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())),
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,11 @@ enum class FeatureFlags(
|
||||||
defaultValue = true,
|
defaultValue = true,
|
||||||
isFinished = false,
|
isFinished = false,
|
||||||
),
|
),
|
||||||
|
RoomModeration(
|
||||||
|
key = "feature.roomModeration",
|
||||||
|
title = "Room moderation",
|
||||||
|
description = "Add moderation features to the room for users with permissions",
|
||||||
|
defaultValue = true,
|
||||||
|
isFinished = false,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ class StaticFeatureFlagProvider @Inject constructor() :
|
||||||
FeatureFlags.Mentions -> true
|
FeatureFlags.Mentions -> true
|
||||||
FeatureFlags.MarkAsUnread -> false
|
FeatureFlags.MarkAsUnread -> false
|
||||||
FeatureFlags.RoomListFilters -> false
|
FeatureFlags.RoomListFilters -> false
|
||||||
|
FeatureFlags.RoomModeration -> false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue