Fixed user warnings
This commit is contained in:
parent
fbdac4f57a
commit
219fffc344
@ -370,7 +370,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
|
|||||||
`LoginMessageChannelId` = {self._login_message_channel_id},
|
`LoginMessageChannelId` = {self._login_message_channel_id},
|
||||||
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
|
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
|
||||||
`ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role},
|
`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},
|
`ResetMemberAfterRejoin` = {self._reset_member_after_rejoin},
|
||||||
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
|
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
|
||||||
`ServerId` = {self._server.id}
|
`ServerId` = {self._server.id}
|
||||||
|
@ -44,7 +44,7 @@ class UserWarningFilter(FilterABC):
|
|||||||
|
|
||||||
if self._user is not None:
|
if self._user is not None:
|
||||||
users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id)
|
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:
|
if self._description is not None:
|
||||||
query = query.where(lambda x: x.description == self._description or self._description in x.description)
|
query = query.where(lambda x: x.description == self._description or self._description in x.description)
|
||||||
|
@ -520,10 +520,10 @@ export class Queries {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
static userWarningsQuery = `
|
static userWarningsQuery = `
|
||||||
query userWarnings($serverId: ID, $page: Page, $sort: Sort) {
|
query userWarnings($serverId: ID, $filter: UserWarningFilter, $page: Page, $sort: Sort) {
|
||||||
servers(filter: {id: $serverId}) {
|
servers(filter: {id: $serverId}) {
|
||||||
userWarningCount
|
userWarningCount
|
||||||
userWarnings(page: $page, sort: $sort) {
|
userWarnings(filter: $filter, page: $page, sort: $sort) {
|
||||||
id
|
id
|
||||||
user {
|
user {
|
||||||
id
|
id
|
||||||
|
@ -48,21 +48,21 @@
|
|||||||
<th hideable-th="description" [parent]="this" [sortable]="true">
|
<th hideable-th="description" [parent]="this" [sortable]="true">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'common.description' | translate}}</div>
|
<div class="table-header-text">{{'common.description' | translate}}</div>
|
||||||
<p-sortIcon field="name" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="description" class="table-header-icon"></p-sortIcon>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th hideable-th="member" [parent]="this" [sortable]="true">
|
<th hideable-th="member" [parent]="this" [sortable]="true">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'common.member' | translate}}</div>
|
<div class="table-header-text">{{'common.member' | translate}}</div>
|
||||||
<p-sortIcon field="attribute" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="user" class="table-header-icon"></p-sortIcon>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th hideable-th="author" [parent]="this" [sortable]="true">
|
<th hideable-th="author" [parent]="this" [sortable]="true">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'common.author' | translate}}</div>
|
<div class="table-header-text">{{'common.author' | translate}}</div>
|
||||||
<p-sortIcon field="operator" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="author" class="table-header-icon"></p-sortIcon>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import { TranslateService } from "@ngx-translate/core";
|
|||||||
import { DataService } from "../../../../../../services/data/data.service";
|
import { DataService } from "../../../../../../services/data/data.service";
|
||||||
import { SidebarService } from "../../../../../../services/sidebar/sidebar.service";
|
import { SidebarService } from "../../../../../../services/sidebar/sidebar.service";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
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 { catchError, debounceTime, takeUntil } from "rxjs/operators";
|
||||||
import { LazyLoadEvent } from "primeng/api";
|
import { LazyLoadEvent } from "primeng/api";
|
||||||
import { Table } from "primeng/table";
|
import { Table } from "primeng/table";
|
||||||
@ -78,12 +78,28 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
|
this.setFilterForm();
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.data.getServerFromRoute(this.route).then(async server => {
|
this.data.getServerFromRoute(this.route).then(async server => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
this.spinner.showSpinner();
|
||||||
let authUser = await this.authService.getLoggedInUser();
|
let authUser = await this.authService.getLoggedInUser();
|
||||||
this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null;
|
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, {
|
this.data.query<UserWarningQuery>(Queries.userWarningsQuery, {
|
||||||
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
|
serverId: this.server.id, filter: this.filter, page: this.page, sort: this.sort
|
||||||
},
|
},
|
||||||
(data: Query) => {
|
(x: { servers: Server[] }) => {
|
||||||
return data.servers[0];
|
return x.servers[0];
|
||||||
}
|
}
|
||||||
).subscribe(data => {
|
).subscribe(data => {
|
||||||
this.totalRecords = data.userWarningCount;
|
this.totalRecords = data.userWarningCount;
|
||||||
this.userWarnings = data.userWarnings;
|
this.userWarnings = data.userWarnings;
|
||||||
|
this.loading = false;
|
||||||
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;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +140,24 @@ export class UserWarningComponent extends ComponentWithTable implements OnInit,
|
|||||||
this.filter.id = undefined;
|
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)
|
if (this.page.pageSize)
|
||||||
this.page.pageSize = 10;
|
this.page.pageSize = 10;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user