ミス廃: ランキングへの参加をオプトインに
This commit is contained in:
parent
29a68897e1
commit
aaf48cf329
8 changed files with 40 additions and 4 deletions
|
@ -19,4 +19,7 @@ export class UserSetting {
|
|||
|
||||
@IsOptional()
|
||||
template?: string;
|
||||
|
||||
@IsOptional()
|
||||
useRanking?: boolean;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ export class SessionController {
|
|||
if (setting.localOnly != null) s.localOnly = setting.localOnly;
|
||||
if (setting.remoteFollowersOnly != null) s.remoteFollowersOnly = setting.remoteFollowersOnly;
|
||||
if (setting.template !== undefined) s.template = setting.template;
|
||||
if (setting.useRanking !== undefined) s.useRanking = setting.useRanking;
|
||||
if (Object.keys(s).length === 0) return;
|
||||
await updateUser(user.username, user.host, s);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ import { User } from '../models/entities/user';
|
|||
*/
|
||||
export const getRanking = async (limit?: number | null): Promise<User[]> => {
|
||||
const query = Users.createQueryBuilder('user')
|
||||
.where('"user"."bannedFromRanking" IS NOT TRUE')
|
||||
.where('"user"."useRanking" IS TRUE')
|
||||
.andWhere('"user"."bannedFromRanking" IS NOT TRUE')
|
||||
.andWhere('"user"."rating" <> \'NaN\'')
|
||||
.orderBy('"user".rating', 'DESC');
|
||||
|
||||
if (limit) {
|
||||
|
|
|
@ -93,6 +93,12 @@ export class User implements IUser {
|
|||
})
|
||||
public rating: number;
|
||||
|
||||
@Column({
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
})
|
||||
public useRanking: boolean;
|
||||
|
||||
@Column({
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue