From 72715aac628b07990ba009616c83b830c9de8064 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 15 Dec 2023 15:38:38 +0100 Subject: [PATCH] Added frontend implementation #460 --- bot/src/bot_data/model/server_config.py | 3 + bot/src/bot_graphql/graphql/serverConfig.gql | 3 +- .../app/models/config/server-config.model.ts | 1 + web/src/app/models/graphql/mutations.model.ts | 3 + web/src/app/models/graphql/queries.model.ts | 1 + .../components/config/config.component.html | 73 +++++++++++++------ .../components/config/config.component.ts | 1 + web/src/assets/i18n/de.json | 1 + web/src/assets/i18n/en.json | 1 + 9 files changed, 65 insertions(+), 22 deletions(-) diff --git a/bot/src/bot_data/model/server_config.py b/bot/src/bot_data/model/server_config.py index d568f953..271329b0 100644 --- a/bot/src/bot_data/model/server_config.py +++ b/bot/src/bot_data/model/server_config.py @@ -321,6 +321,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): `DefaultRoleId`, `ShortRoleNameSetOnlyHighest`, `GameOfferNotificationChatId`, + `ResetMemberAfterRejoin`, `FeatureFlags`, `ServerId` ) VALUES ( @@ -341,6 +342,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): {"NULL" if self._default_role_id is None else self._default_role_id}, {self._short_role_name_only_set_highest_role}, {self._game_offer_notification_chat_id}, + {self._reset_member_after_rejoin}, '{json.dumps(self._feature_flags)}', {self._server.id} ); @@ -369,6 +371,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): `DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id}, `ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role}, `GameOfferNotificationChatId` = {self._game_offer_notification_chat_id}, + `ResetMemberAfterRejoin` = {self._reset_member_after_rejoin}, `FeatureFlags` = '{json.dumps(self._feature_flags)}', `ServerId` = {self._server.id} WHERE `Id` = {self._id}; diff --git a/bot/src/bot_graphql/graphql/serverConfig.gql b/bot/src/bot_graphql/graphql/serverConfig.gql index ca6c17c7..a35b5a18 100644 --- a/bot/src/bot_graphql/graphql/serverConfig.gql +++ b/bot/src/bot_graphql/graphql/serverConfig.gql @@ -51,7 +51,7 @@ type ServerConfigHistory implements HistoryTableQuery { loginMessageChannelId: String defaultRoleId: String shortRoleNameOnlySetHighestRole: Boolean - gameOfferNotificationChatId: String + resetMemberAfterRejoin: Boolean featureFlagCount: Int featureFlags: [FeatureFlag] @@ -104,6 +104,7 @@ input ServerConfigInput { defaultRoleId: String shortRoleNameOnlySetHighestRole: Boolean gameOfferNotificationChatId: String + resetMemberAfterRejoin: Boolean featureFlags: [FeatureFlagInput] afkChannelIds: [String] diff --git a/web/src/app/models/config/server-config.model.ts b/web/src/app/models/config/server-config.model.ts index 616dbecc..bf31a525 100644 --- a/web/src/app/models/config/server-config.model.ts +++ b/web/src/app/models/config/server-config.model.ts @@ -20,6 +20,7 @@ export interface ServerConfig extends DataWithHistory { defaultRoleId?: string; shortRoleNameOnlySetHighestRole?: boolean; gameOfferNotificationChatId?: string; + resetMemberAfterRejoin?: boolean; featureFlags: FeatureFlag[]; afkChannelIds: string[]; moderatorRoleIds: string[]; diff --git a/web/src/app/models/graphql/mutations.model.ts b/web/src/app/models/graphql/mutations.model.ts index bdac7b0c..586f3928 100644 --- a/web/src/app/models/graphql/mutations.model.ts +++ b/web/src/app/models/graphql/mutations.model.ts @@ -340,6 +340,7 @@ export class Mutations { $defaultRoleId: String, $shortRoleNameOnlySetHighestRole: Boolean, $gameOfferNotificationChatId: String, + $resetMemberAfterRejoin: Boolean, $featureFlags: [FeatureFlagInput], $afkChannelIds: [String], $moderatorRoleIds: [String], @@ -365,6 +366,7 @@ export class Mutations { defaultRoleId: $defaultRoleId, shortRoleNameOnlySetHighestRole: $shortRoleNameOnlySetHighestRole, gameOfferNotificationChatId: $gameOfferNotificationChatId, + resetMemberAfterRejoin: $resetMemberAfterRejoin, featureFlags: $featureFlags, afkChannelIds: $afkChannelIds, moderatorRoleIds: $moderatorRoleIds, @@ -388,6 +390,7 @@ export class Mutations { defaultRoleId shortRoleNameOnlySetHighestRole gameOfferNotificationChatId + resetMemberAfterRejoin featureFlags { key value diff --git a/web/src/app/models/graphql/queries.model.ts b/web/src/app/models/graphql/queries.model.ts index d5ceb096..a387b22e 100644 --- a/web/src/app/models/graphql/queries.model.ts +++ b/web/src/app/models/graphql/queries.model.ts @@ -637,6 +637,7 @@ export class Queries { defaultRoleId shortRoleNameOnlySetHighestRole gameOfferNotificationChatId + resetMemberAfterRejoin featureFlags { key value diff --git a/web/src/app/modules/view/server/config/components/config/config.component.html b/web/src/app/modules/view/server/config/components/config/config.component.html index 8bc387f3..1a5fd307 100644 --- a/web/src/app/modules/view/server/config/components/config/config.component.html +++ b/web/src/app/modules/view/server/config/components/config/config.component.html @@ -14,14 +14,16 @@
{{'view.server.config.bot.message_delete_timer' | translate}}:
+ placeholder="{{'view.server.config.bot.message_delete_timer' | translate}}"> +
{{'view.server.config.bot.notification_chat_id' | translate}}:
-
@@ -30,14 +32,16 @@
{{'view.server.config.bot.max_voice_state_hours' | translate}}:
+ placeholder="{{'view.server.config.bot.max_voice_state_hours' | translate}}"> +
{{'view.server.config.bot.xp_per_message' | translate}}:
-
+
@@ -45,7 +49,8 @@
{{'view.server.config.bot.xp_per_reaction' | translate}}:
-
+
@@ -54,7 +59,8 @@
{{'view.server.config.bot.max_message_xp_per_hour' | translate}}:
+ placeholder="{{'view.server.config.bot.max_message_xp_per_hour' | translate}}"> +
@@ -62,7 +68,8 @@
{{'view.server.config.bot.xp_per_ontime_hour' | translate}}:
+ placeholder="{{'view.server.config.bot.xp_per_ontime_hour' | translate}}"> +
@@ -70,7 +77,8 @@
{{'view.server.config.bot.xp_per_event_participation' | translate}}:
+ placeholder="{{'view.server.config.bot.xp_per_event_participation' | translate}}"> +
@@ -78,7 +86,8 @@
{{'view.server.config.bot.xp_per_achievement' | translate}}:
+ placeholder="{{'view.server.config.bot.xp_per_achievement' | translate}}"> +
@@ -86,14 +95,16 @@
{{'view.server.config.bot.xp_for_birthday' | translate}}:
+ placeholder="{{'view.server.config.bot.xp_for_birthday' | translate}}"> +
{{'view.server.config.bot.afk_command_channel_id' | translate}}:
-
@@ -101,7 +112,8 @@
{{'view.server.config.bot.help_voice_channel_id' | translate}}:
-
@@ -109,7 +121,8 @@
{{'view.server.config.bot.team_channel_id' | translate}}:
-
@@ -117,7 +130,8 @@
{{'view.server.config.bot.login_message_channel_id' | translate}}:
-
@@ -125,15 +139,18 @@
{{'view.server.config.bot.default_role_id' | translate}}:
-
-
{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}:
- {{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}: +
+
@@ -141,17 +158,31 @@
{{'view.server.config.bot.game_offer_notification_chat_id' | translate}}:
-
+
+
+
{{'view.server.config.bot.reset_member_after_rejoin' | translate}}:
+ +
+
+
- - - +
diff --git a/web/src/app/modules/view/server/config/components/config/config.component.ts b/web/src/app/modules/view/server/config/components/config/config.component.ts index 0c39cd02..80356584 100644 --- a/web/src/app/modules/view/server/config/components/config/config.component.ts +++ b/web/src/app/modules/view/server/config/components/config/config.component.ts @@ -126,6 +126,7 @@ export class ConfigComponent implements OnInit { defaultRoleId: this.config.defaultRoleId, shortRoleNameOnlySetHighestRole: this.config.shortRoleNameOnlySetHighestRole, gameOfferNotificationChatId: this.config.gameOfferNotificationChatId, + resetMemberAfterRejoin: this.config.resetMemberAfterRejoin, featureFlags: this.config.featureFlags, afkChannelIds: this.config.afkChannelIds, moderatorRoleIds: this.config.moderatorRoleIds, diff --git a/web/src/assets/i18n/de.json b/web/src/assets/i18n/de.json index a17ac8e9..8c8e20e2 100644 --- a/web/src/assets/i18n/de.json +++ b/web/src/assets/i18n/de.json @@ -455,6 +455,7 @@ "message_delete_timer": "Zeit bis zum löschen einer Botnachricht in sekunden", "moderator_roles": "Moderator Rollen", "notification_chat_id": "Benachrichtungskanal", + "reset_member_after_rejoin": "Mitglied nach erneutem Beitritt zurücksetzen", "short_role_name_only_set_highest_role": "Bei Rollen Kürzeln nur die höchste Rolle verwenden", "team_channel_id": "Team chat", "xp_for_birthday": "XP für Geburtstag", diff --git a/web/src/assets/i18n/en.json b/web/src/assets/i18n/en.json index 66b67e7a..ec26f08d 100644 --- a/web/src/assets/i18n/en.json +++ b/web/src/assets/i18n/en.json @@ -455,6 +455,7 @@ "message_delete_timer": "Time to wait before delete bot messages", "moderator_roles": "Moderator roles", "notification_chat_id": "Notification channel", + "reset_member_after_rejoin": "Reset member after rejoin", "short_role_name_only_set_highest_role": "For role abbreviations use only the highest role", "team_channel_id": "Team chat", "xp_for_birthday": "XP for birthday",