#360 #361

Merged
edraft merged 8 commits from #360 into support 2023-09-24 20:33:09 +02:00
13 changed files with 30 additions and 8 deletions
Showing only changes of commit 9e0905d49e - Show all commits

View File

@ -4,7 +4,7 @@ from bot_data.db_context import DBContext
class DefaultRoleMigration(MigrationABC):
name = "1.1.3_ConfigMigration"
name = "1.1.3_DefaultRoleMigration"
def __init__(self, logger: DatabaseLogger, db: DBContext):
MigrationABC.__init__(self)

View File

@ -247,6 +247,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`HelpVoiceChannelId`,
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`FeatureFlags`,
`ServerId`
) VALUES (
@ -263,6 +264,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._help_voice_channel_id},
{self._team_channel_id},
{self._login_message_channel_id},
{self._default_role_id},
'{json.dumps(self._feature_flags)}',
{self._server.id}
);
@ -287,6 +289,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`HelpVoiceChannelId` = {self._help_voice_channel_id},
`TeamChannelId` = {self._team_channel_id},
`LoginMessageChannelId` = {self._login_message_channel_id},
`DefaultRoleId` = {self._default_role_id},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};

View File

@ -67,10 +67,10 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC):
result[14],
json.loads(result[15]),
self._servers.get_server_by_id(result[16]),
self._get_afk_channel_ids(result[17]),
self._get_team_role_ids(result[18]),
result[19],
result[20],
self._get_afk_channel_ids(result[16]),
self._get_team_role_ids(result[16]),
result[17],
result[18],
id=result[0],
)

View File

@ -44,6 +44,7 @@ type ServerConfigHistory implements HistoryTableQuery {
helpVoiceChannelId: String
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -92,6 +93,7 @@ input ServerConfigInput {
helpVoiceChannelId: String
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
featureFlags: [FeatureFlagInput]
afkChannelIds: [String]

View File

@ -89,6 +89,9 @@ class ServerConfigMutation(QueryABC):
if "loginMessageChannelId" in input
else server_config.login_message_channel_id
)
server_config.default_role_id = (
input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id
)
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

@ -1,6 +1,6 @@
{
"name": "kdb-web",
"version": "1.1.1",
"version": "1.1.dev360",
"scripts": {
"ng": "ng",
"update-version": "ts-node update-version.ts",
@ -51,4 +51,4 @@
"tslib": "^2.4.1",
"typescript": "~4.9.5"
}
}
}

View File

@ -16,6 +16,7 @@ export interface ServerConfig extends DataWithHistory {
helpVoiceChannelId?: string;
teamChannelId?: string;
loginMessageChannelId?: string;
defaultRoleId?: string;
featureFlags: FeatureFlag[];
afkChannelIds: string[];
moderatorRoleIds: string[];

View File

@ -211,6 +211,7 @@ export class Mutations {
$helpVoiceChannelId: String,
$teamChannelId: String,
$loginMessageChannelId: String,
$defaultRoleId: String,
$featureFlags: [FeatureFlagInput],
$afkChannelIds: [String],
$moderatorRoleIds: [String],
@ -232,6 +233,7 @@ export class Mutations {
helpVoiceChannelId: $helpVoiceChannelId,
teamChannelId: $teamChannelId,
loginMessageChannelId: $loginMessageChannelId,
defaultRoleId: $defaultRoleId,
featureFlags: $featureFlags,
afkChannelIds: $afkChannelIds,
moderatorRoleIds: $moderatorRoleIds,

View File

@ -424,6 +424,7 @@ export class Queries {
helpVoiceChannelId
teamChannelId
loginMessageChannelId
defaultRoleId
featureFlags {
key
value

View File

@ -114,6 +114,14 @@
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.login_message_channel_id' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="roles ?? []" optionLabel="name" optionValue="id" [(ngModel)]="config.defaultRoleId"
placeholder="{{'view.server.config.bot.default_role_id' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-divider"></div>
<app-config-list [options]="voiceChannels" optionLabel="name" optionValue="id" translationKey="view.server.config.bot.afk_channels"
[(data)]="config.afkChannelIds"></app-config-list>

View File

@ -118,6 +118,7 @@ export class ConfigComponent implements OnInit {
helpVoiceChannelId: this.config.helpVoiceChannelId,
teamChannelId: this.config.teamChannelId,
loginMessageChannelId: this.config.loginMessageChannelId,
defaultRoleId: this.config.defaultRoleId,
featureFlags: this.config.featureFlags,
afkChannelIds: this.config.afkChannelIds,
moderatorRoleIds: this.config.moderatorRoleIds,

View File

@ -415,6 +415,7 @@
"header": "Bot Konfiguration",
"help_voice_channel_id": "Sprachkanal für Hilfsbenachrichtung",
"login_message_channel_id": "Kanal für die Nachricht vom Bot nach Start",
"default_role_id": "Standardrolle des Servers",
"max_message_xp_per_hour": "Maximale XP pro Stunde durch Nachrichten",
"max_voice_state_hours": "Maximale Stunden für eine ontime nach Bot neustart",
"message_delete_timer": "Zeit bis zum löschen einer Botnachricht in sekunden",

View File

@ -2,6 +2,6 @@
"WebVersion": {
"Major": "1",
"Minor": "1",
"Micro": "1"
"Micro": "dev360"
}
}