enhance: コンディショナルロールの条件に「投稿数が~以下」「投稿数が~以上」を追加

Resolve #10395
This commit is contained in:
syuilo 2023-03-23 17:18:38 +09:00
parent 48a97d25e5
commit 41d1b1b8c9
5 changed files with 28 additions and 4 deletions

View file

@ -15,7 +15,7 @@
## 13.x.x (unreleased) ## 13.x.x (unreleased)
### General ### General
- - コンディショナルロールの条件に「投稿数が~以下」「投稿数が~以上」を追加
### Client ### Client
- センシティブワードの一覧にピン留めユーザーのIDが表示される問題を修正 - センシティブワードの一覧にピン留めユーザーのIDが表示される問題を修正

View file

@ -1279,6 +1279,8 @@ _role:
followersMoreThanOrEq: "フォロワー数が~以上" followersMoreThanOrEq: "フォロワー数が~以上"
followingLessThanOrEq: "フォロー数が~以下" followingLessThanOrEq: "フォロー数が~以下"
followingMoreThanOrEq: "フォロー数が~以上" followingMoreThanOrEq: "フォロー数が~以上"
notesLessThanOrEq: "投稿数が~以下"
notesMoreThanOrEq: "投稿数が~以上"
and: "~かつ~" and: "~かつ~"
or: "~または~" or: "~または~"
not: "~ではない" not: "~ではない"
@ -1929,4 +1931,4 @@ _disabledTimeline:
_drivecleaner: _drivecleaner:
orderBySizeDesc: "サイズが大きい順" orderBySizeDesc: "サイズが大きい順"
orderByCreatedAtAsc: "追加日が古い順" orderByCreatedAtAsc: "追加日が古い順"

View file

@ -192,6 +192,12 @@ export class RoleService implements OnApplicationShutdown {
case 'followingMoreThanOrEq': { case 'followingMoreThanOrEq': {
return user.followingCount >= value.value; return user.followingCount >= value.value;
} }
case 'notesLessThanOrEq': {
return user.notesCount <= value.value;
}
case 'notesMoreThanOrEq': {
return user.notesCount >= value.value;
}
default: default:
return false; return false;
} }

View file

@ -54,6 +54,16 @@ type CondFormulaValueFollowingMoreThanOrEq = {
value: number; value: number;
}; };
type CondFormulaValueNotesLessThanOrEq = {
type: 'notesLessThanOrEq';
value: number;
};
type CondFormulaValueNotesMoreThanOrEq = {
type: 'notesMoreThanOrEq';
value: number;
};
export type RoleCondFormulaValue = export type RoleCondFormulaValue =
CondFormulaValueAnd | CondFormulaValueAnd |
CondFormulaValueOr | CondFormulaValueOr |
@ -65,7 +75,9 @@ export type RoleCondFormulaValue =
CondFormulaValueFollowersLessThanOrEq | CondFormulaValueFollowersLessThanOrEq |
CondFormulaValueFollowersMoreThanOrEq | CondFormulaValueFollowersMoreThanOrEq |
CondFormulaValueFollowingLessThanOrEq | CondFormulaValueFollowingLessThanOrEq |
CondFormulaValueFollowingMoreThanOrEq; CondFormulaValueFollowingMoreThanOrEq |
CondFormulaValueNotesLessThanOrEq |
CondFormulaValueNotesMoreThanOrEq;
@Entity() @Entity()
export class Role { export class Role {

View file

@ -10,6 +10,8 @@
<option value="followersMoreThanOrEq">{{ i18n.ts._role._condition.followersMoreThanOrEq }}</option> <option value="followersMoreThanOrEq">{{ i18n.ts._role._condition.followersMoreThanOrEq }}</option>
<option value="followingLessThanOrEq">{{ i18n.ts._role._condition.followingLessThanOrEq }}</option> <option value="followingLessThanOrEq">{{ i18n.ts._role._condition.followingLessThanOrEq }}</option>
<option value="followingMoreThanOrEq">{{ i18n.ts._role._condition.followingMoreThanOrEq }}</option> <option value="followingMoreThanOrEq">{{ i18n.ts._role._condition.followingMoreThanOrEq }}</option>
<option value="notesLessThanOrEq">{{ i18n.ts._role._condition.notesLessThanOrEq }}</option>
<option value="notesMoreThanOrEq">{{ i18n.ts._role._condition.notesMoreThanOrEq }}</option>
<option value="and">{{ i18n.ts._role._condition.and }}</option> <option value="and">{{ i18n.ts._role._condition.and }}</option>
<option value="or">{{ i18n.ts._role._condition.or }}</option> <option value="or">{{ i18n.ts._role._condition.or }}</option>
<option value="not">{{ i18n.ts._role._condition.not }}</option> <option value="not">{{ i18n.ts._role._condition.not }}</option>
@ -42,7 +44,7 @@
<template #suffix>sec</template> <template #suffix>sec</template>
</MkInput> </MkInput>
<MkInput v-else-if="['followersLessThanOrEq', 'followersMoreThanOrEq', 'followingLessThanOrEq', 'followingMoreThanOrEq'].includes(type)" v-model="v.value" type="number"> <MkInput v-else-if="['followersLessThanOrEq', 'followersMoreThanOrEq', 'followingLessThanOrEq', 'followingMoreThanOrEq', 'notesLessThanOrEq', 'notesMoreThanOrEq'].includes(type)" v-model="v.value" type="number">
</MkInput> </MkInput>
</div> </div>
</template> </template>
@ -91,6 +93,8 @@ const type = computed({
if (t === 'followersMoreThanOrEq') v.value.value = 10; if (t === 'followersMoreThanOrEq') v.value.value = 10;
if (t === 'followingLessThanOrEq') v.value.value = 10; if (t === 'followingLessThanOrEq') v.value.value = 10;
if (t === 'followingMoreThanOrEq') v.value.value = 10; if (t === 'followingMoreThanOrEq') v.value.value = 10;
if (t === 'notesLessThanOrEq') v.value.value = 10;
if (t === 'notesMoreThanOrEq') v.value.value = 10;
v.value.type = t; v.value.type = t;
}, },
}); });