Merge branch 'develop' into mkjs-n

This commit is contained in:
tamaina
2023-05-19 22:45:50 +09:00
committed by GitHub
94 changed files with 1134 additions and 421 deletions

View File

@@ -306,6 +306,14 @@ export class RoleService implements OnApplicationShutdown {
return user.isRoot || (await this.getUserRoles(user.id)).some(r => r.isAdministrator);
}
@bindThis
public async isExplorable(role: { id: Role['id']} | null): Promise<boolean> {
if (role == null) return false;
const check = await this.rolesRepository.findOneBy({ id: role.id });
if (check == null) return false;
return check.isExplorable;
}
@bindThis
public async getModeratorIds(includeAdmins = true): Promise<User['id'][]> {
const roles = await this.rolesCache.fetch(() => this.rolesRepository.findBy({}));