merge: Add new role conditions for local/remote followers/followees (!1002)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1002

Approved-by: Marie <github@yuugi.dev>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
Hazelnoot 2025-05-12 09:37:17 +00:00
commit 0f68914610
6 changed files with 267 additions and 7 deletions

View file

@ -22,6 +22,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="followersMoreThanOrEq">{{ i18n.ts._role._condition.followersMoreThanOrEq }}</option>
<option value="followingLessThanOrEq">{{ i18n.ts._role._condition.followingLessThanOrEq }}</option>
<option value="followingMoreThanOrEq">{{ i18n.ts._role._condition.followingMoreThanOrEq }}</option>
<option value="localFollowersLessThanOrEq">{{ i18n.ts._role._condition.localFollowersLessThanOrEq }}</option>
<option value="localFollowersMoreThanOrEq">{{ i18n.ts._role._condition.localFollowersMoreThanOrEq }}</option>
<option value="localFollowingLessThanOrEq">{{ i18n.ts._role._condition.localFollowingLessThanOrEq }}</option>
<option value="localFollowingMoreThanOrEq">{{ i18n.ts._role._condition.localFollowingMoreThanOrEq }}</option>
<option value="remoteFollowersLessThanOrEq">{{ i18n.ts._role._condition.remoteFollowersLessThanOrEq }}</option>
<option value="remoteFollowersMoreThanOrEq">{{ i18n.ts._role._condition.remoteFollowersMoreThanOrEq }}</option>
<option value="remoteFollowingLessThanOrEq">{{ i18n.ts._role._condition.remoteFollowingLessThanOrEq }}</option>
<option value="remoteFollowingMoreThanOrEq">{{ i18n.ts._role._condition.remoteFollowingMoreThanOrEq }}</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>
@ -56,7 +64,26 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #suffix>sec</template>
</MkInput>
<MkInput v-else-if="['followersLessThanOrEq', 'followersMoreThanOrEq', 'followingLessThanOrEq', 'followingMoreThanOrEq', 'notesLessThanOrEq', 'notesMoreThanOrEq'].includes(type)" v-model="v.value" type="number">
<MkInput
v-else-if="[
'followersLessThanOrEq',
'followersMoreThanOrEq',
'followingLessThanOrEq',
'followingMoreThanOrEq',
'localFollowersLessThanOrEq',
'localFollowersMoreThanOrEq',
'localFollowingLessThanOrEq',
'localFollowingMoreThanOrEq',
'remoteFollowersLessThanOrEq',
'remoteFollowersMoreThanOrEq',
'remoteFollowingLessThanOrEq',
'remoteFollowingMoreThanOrEq',
'notesLessThanOrEq',
'notesMoreThanOrEq'
].includes(type)"
v-model="v.value"
type="number"
>
</MkInput>
<MkSelect v-else-if="type === 'roleAssignedTo'" v-model="v.roleId">
@ -70,6 +97,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-if="type === 'isFromInstance'" v-model="v.subdomains">
<template #label>{{ i18n.ts._role._condition.isFromInstanceSubdomains }}</template>
</MkSwitch>
<div v-if="['remoteFollowersLessThanOrEq', 'remoteFollowersMoreThanOrEq', 'remoteFollowingLessThanOrEq', 'remoteFollowingMoreThanOrEq'].includes(type)" :class="$style.warningBanner">
<i class="ti ti-alert-triangle"></i>
{{ i18n.ts._role.remoteDataWarning }}
</div>
</div>
</template>
@ -123,6 +155,14 @@ const type = computed({
if (t === 'followersMoreThanOrEq') v.value.value = 10;
if (t === 'followingLessThanOrEq') v.value.value = 10;
if (t === 'followingMoreThanOrEq') v.value.value = 10;
if (t === 'localFollowersLessThanOrEq') v.value.value = 10;
if (t === 'localFollowersMoreThanOrEq') v.value.value = 10;
if (t === 'localFollowingLessThanOrEq') v.value.value = 10;
if (t === 'localFollowingMoreThanOrEq') v.value.value = 10;
if (t === 'remoteFollowersLessThanOrEq') v.value.value = 10;
if (t === 'remoteFollowersMoreThanOrEq') v.value.value = 10;
if (t === 'remoteFollowingLessThanOrEq') v.value.value = 10;
if (t === 'remoteFollowingMoreThanOrEq') v.value.value = 10;
if (t === 'notesLessThanOrEq') v.value.value = 10;
if (t === 'notesMoreThanOrEq') v.value.value = 10;
if (t === 'isFromInstance') {
@ -178,4 +218,14 @@ function removeSelf() {
border-color: var(--MI_THEME-accent);
}
}
.warningBanner {
color: var(--MI_THEME-warn);
width: 100%;
padding: 0 6px;
> i {
margin-right: 4px;
}
}
</style>