diff --git a/bot/src/bot_data/model/server_config.py b/bot/src/bot_data/model/server_config.py
index 271329b0..72a0dd29 100644
--- a/bot/src/bot_data/model/server_config.py
+++ b/bot/src/bot_data/model/server_config.py
@@ -370,7 +370,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`LoginMessageChannelId` = {self._login_message_channel_id},
`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},
+ `GameOfferNotificationChatId` = {"NULL" if self._game_offer_notification_chat_id is None else self._game_offer_notification_chat_id},
`ResetMemberAfterRejoin` = {self._reset_member_after_rejoin},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
diff --git a/bot/src/bot_graphql/filter/user_warning_filter.py b/bot/src/bot_graphql/filter/user_warning_filter.py
index 2c716c9e..b3614c1a 100644
--- a/bot/src/bot_graphql/filter/user_warning_filter.py
+++ b/bot/src/bot_graphql/filter/user_warning_filter.py
@@ -44,7 +44,7 @@ class UserWarningFilter(FilterABC):
if self._user is not None:
users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id)
- query = query.where(lambda x: x.id in users)
+ query = query.where(lambda x: x.user.id in users)
if self._description is not None:
query = query.where(lambda x: x.description == self._description or self._description in x.description)
diff --git a/web/src/app/models/graphql/queries.model.ts b/web/src/app/models/graphql/queries.model.ts
index e5448075..818b3d5f 100644
--- a/web/src/app/models/graphql/queries.model.ts
+++ b/web/src/app/models/graphql/queries.model.ts
@@ -520,10 +520,10 @@ export class Queries {
`;
static userWarningsQuery = `
- query userWarnings($serverId: ID, $page: Page, $sort: Sort) {
+ query userWarnings($serverId: ID, $filter: UserWarningFilter, $page: Page, $sort: Sort) {
servers(filter: {id: $serverId}) {
userWarningCount
- userWarnings(page: $page, sort: $sort) {
+ userWarnings(filter: $filter, page: $page, sort: $sort) {
id
user {
id
diff --git a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.html b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.html
index 22393b64..53fa79b4 100644
--- a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.html
+++ b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.html
@@ -48,21 +48,21 @@
|
|
|
diff --git a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts
index e8b1d761..507d9554 100644
--- a/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts
+++ b/web/src/app/modules/view/server/user-warning/components/user-warning/user-warning.component.ts
@@ -14,7 +14,7 @@ import { TranslateService } from "@ngx-translate/core";
import { DataService } from "../../../../../../services/data/data.service";
import { SidebarService } from "../../../../../../services/sidebar/sidebar.service";
import { ActivatedRoute } from "@angular/router";
-import { Query, UserListQuery, UserWarningQuery } from "../../../../../../models/graphql/query.model";
+import { UserListQuery, UserWarningQuery } from "../../../../../../models/graphql/query.model";
import { catchError, debounceTime, takeUntil } from "rxjs/operators";
import { LazyLoadEvent } from "primeng/api";
import { Table } from "primeng/table";
@@ -78,12 +78,28 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
}
public ngOnInit(): void {
+ this.setFilterForm();
+
this.loading = true;
this.data.getServerFromRoute(this.route).then(async server => {
this.server = server;
+ this.spinner.showSpinner();
let authUser = await this.authService.getLoggedInUser();
this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null;
- this.setFilterForm();
+
+ this.data.query(Queries.liteUsersQuery, {
+ serverId: this.server.id, filter: {
+ leftServer: false
+ }
+ },
+ (x: { servers: Server[] }) => {
+ return x.servers[0];
+ }
+ ).subscribe(data => {
+ this.users = data.users;
+ });
+ this.spinner.hideSpinner();
+ this.loadNextPage();
});
}
@@ -96,27 +112,13 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
this.data.query(Queries.userWarningsQuery, {
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
},
- (data: Query) => {
- return data.servers[0];
+ (x: { servers: Server[] }) => {
+ return x.servers[0];
}
).subscribe(data => {
this.totalRecords = data.userWarningCount;
this.userWarnings = data.userWarnings;
-
- this.data.query(Queries.liteUsersQuery, {
- serverId: this.server.id, filter: {
- leftServer: false
- }
- },
- (x: { servers: Server[] }) => {
- return x.servers[0];
- }
- ).subscribe(data => {
- this.users = data.users;
-
- this.spinner.hideSpinner();
- this.loading = false;
- });
+ this.loading = false;
});
}
@@ -138,6 +140,24 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
this.filter.id = undefined;
}
+ if (changes.description) {
+ this.filter.description = changes.description;
+ } else {
+ this.filter.description = undefined;
+ }
+
+ if (changes.user) {
+ this.filter.user = { name: changes.user };
+ } else {
+ this.filter.user = undefined;
+ }
+
+ if (changes.author) {
+ this.filter.author = { name: changes.author };
+ } else {
+ this.filter.author = undefined;
+ }
+
if (this.page.pageSize)
this.page.pageSize = 10;