🐛Do not show anonymous user is the user list everywhere on UI (#182)
* 🐛Do not show anonymous user is the user list everywhere on UI
This commit is contained in:
@@ -4,6 +4,7 @@ import search from "./user.search";
|
||||
import { uuid } from "../../../utils/types";
|
||||
|
||||
export const TYPE = "user";
|
||||
export type UserType = "anonymous" | "tech" | "regular";
|
||||
|
||||
@Entity(TYPE, {
|
||||
primaryKey: [["id"]],
|
||||
@@ -92,6 +93,9 @@ export default class User {
|
||||
@Column("timezone", "string")
|
||||
timezone: string; //Depreciated (php legacy)
|
||||
|
||||
@Column("type", "string")
|
||||
type: UserType;
|
||||
|
||||
@Column("preferences", "encoded_json")
|
||||
preferences: null | {
|
||||
locale?: string;
|
||||
|
||||
@@ -163,18 +163,23 @@ export class UserServiceImpl {
|
||||
options?: SearchUserOptions,
|
||||
context?: ExecutionContext,
|
||||
): Promise<ListResult<User>> {
|
||||
return await this.searchRepository.search(
|
||||
{},
|
||||
{
|
||||
pagination,
|
||||
...(options.companyId ? { $in: [["companies", [options.companyId]]] } : {}),
|
||||
...(options.workspaceId ? { $in: [["workspaces", [options.workspaceId]]] } : {}),
|
||||
$text: {
|
||||
$search: options.search,
|
||||
return await this.searchRepository
|
||||
.search(
|
||||
{},
|
||||
{
|
||||
pagination,
|
||||
...(options.companyId ? { $in: [["companies", [options.companyId]]] } : {}),
|
||||
...(options.workspaceId ? { $in: [["workspaces", [options.workspaceId]]] } : {}),
|
||||
$text: {
|
||||
$search: options.search,
|
||||
},
|
||||
},
|
||||
},
|
||||
context,
|
||||
);
|
||||
context,
|
||||
)
|
||||
.then(users => {
|
||||
users.filterEntities(u => u.identity_provider != "anonymous" && u.type != "anonymous");
|
||||
return users;
|
||||
});
|
||||
}
|
||||
|
||||
async list(
|
||||
|
||||
Reference in New Issue
Block a user