Fixed user warnings
Deploy prod on push / pre-build (push) Successful in 1s Details
Deploy prod on push / build-web (push) Has been cancelled Details
Deploy prod on push / deploy (push) Has been cancelled Details
Deploy prod on push / build-bot (push) Has been cancelled Details

This commit is contained in:
Sven Heidemann 2024-01-26 19:20:22 +01:00
parent fbdac4f57a
commit b552e8a048
4 changed files with 43 additions and 23 deletions

View File

@ -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}

View File

@ -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)

View File

@ -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

View File

@ -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<UserListQuery>(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<UserWarningQuery>(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<UserListQuery>(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;