Added highest role setting to gql #391

This commit is contained in:
Sven Heidemann 2023-10-02 08:01:17 +02:00
parent a9c9880fd4
commit 2182c021b9
3 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,7 @@ type ServerConfig implements TableWithHistoryQuery {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -45,6 +46,7 @@ type ServerConfigHistory implements HistoryTableQuery {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -94,6 +96,7 @@ input ServerConfigInput {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlags: [FeatureFlagInput]
afkChannelIds: [String]

View File

@ -92,6 +92,11 @@ class ServerConfigMutation(QueryABC):
server_config.default_role_id = (
input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id
)
server_config.default_role_id = (
input["shortRoleNameOnlySetHighestRole"]
if "shortRoleNameOnlySetHighestRole" in input
else server_config.short_role_name_only_set_highest_role
)
server_config.feature_flags = (
dict(zip([x["key"] for x in input["featureFlags"]], [x["value"] for x in input["featureFlags"]]))
if "featureFlags" in input

View File

@ -25,6 +25,9 @@ class ServerConfigQuery(DataQueryWithHistoryABC):
self.set_field("teamChannelId", lambda config, *_: config.team_channel_id)
self.set_field("loginMessageChannelId", lambda config, *_: config.login_message_channel_id)
self.set_field("defaultRoleId", lambda config, *_: config.default_role_id)
self.set_field(
"shortRoleNameOnlySetHighestRole", lambda config, *_: config.short_role_name_only_set_highest_role
)
self.add_collection(
"featureFlag",
lambda config, *_: List(any, [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags]),