summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-12 20:08:56 +0000
committerHazelnoot <acomputerdog@gmail.com>2025-05-12 20:08:56 +0000
commit00cfeca3d7aff3a727be6b80f86f93b4332b490c (patch)
tree8bce4020a6a4cfee89eb2f683193e85228e7f6e9
parentmerge: Always show bubble controls (!1023) (diff)
parentfix wording of "User is from a bubble instance" (diff)
downloadsharkey-00cfeca3d7aff3a727be6b80f86f93b4332b490c.tar.gz
sharkey-00cfeca3d7aff3a727be6b80f86f93b4332b490c.tar.bz2
sharkey-00cfeca3d7aff3a727be6b80f86f93b4332b490c.zip
merge: Add "is from local bubble instance" role condition (!1011)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1011 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
-rw-r--r--locales/index.d.ts4
-rw-r--r--packages/backend/src/core/RoleService.ts4
-rw-r--r--packages/backend/src/models/Role.ts8
-rw-r--r--packages/frontend/src/pages/admin/RolesEditorFormula.vue1
-rw-r--r--sharkey-locales/en-US.yml1
5 files changed, 18 insertions, 0 deletions
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 5cbe918183..59637f0bcf 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -7690,6 +7690,10 @@ export interface Locale extends ILocale {
*/
"isFromInstanceSubdomains": string;
/**
+ * User is from a bubble instance
+ */
+ "fromBubbleInstance": string;
+ /**
* Has X or fewer local followers
*/
"localFollowersLessThanOrEq": string;
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts
index e87c459d5c..039932b76d 100644
--- a/packages/backend/src/core/RoleService.ts
+++ b/packages/backend/src/core/RoleService.ts
@@ -262,6 +262,10 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
return user.host.toLowerCase() === value.host.toLowerCase();
}
}
+ // Is the user from a local bubble instance
+ case 'fromBubbleInstance': {
+ return user.host != null && this.meta.bubbleInstances.includes(user.host);
+ }
// サスペンド済みユーザである
case 'isSuspended': {
return user.isSuspended;
diff --git a/packages/backend/src/models/Role.ts b/packages/backend/src/models/Role.ts
index 2caf3e0bd3..f6e3050830 100644
--- a/packages/backend/src/models/Role.ts
+++ b/packages/backend/src/models/Role.ts
@@ -57,6 +57,13 @@ type CondFormulaValueIsFromInstance = {
};
/**
+ * Is the user from a local bubble instance
+ */
+type CondFormulaValueFromBubbleInstance = {
+ type: 'fromBubbleInstance';
+};
+
+/**
* 既に指定のマニュアルロールにアサインされている場合のみ成立とする
*/
type CondFormulaValueRoleAssignedTo = {
@@ -234,6 +241,7 @@ export type RoleCondFormulaValue = { id: string } & (
CondFormulaValueIsLocal |
CondFormulaValueIsRemote |
CondFormulaValueIsFromInstance |
+ CondFormulaValueFromBubbleInstance |
CondFormulaValueIsSuspended |
CondFormulaValueIsLocked |
CondFormulaValueIsBot |
diff --git a/packages/frontend/src/pages/admin/RolesEditorFormula.vue b/packages/frontend/src/pages/admin/RolesEditorFormula.vue
index 0f3afd5b22..b7375b0faf 100644
--- a/packages/frontend/src/pages/admin/RolesEditorFormula.vue
+++ b/packages/frontend/src/pages/admin/RolesEditorFormula.vue
@@ -10,6 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="isLocal">{{ i18n.ts._role._condition.isLocal }}</option>
<option value="isRemote">{{ i18n.ts._role._condition.isRemote }}</option>
<option value="isFromInstance">{{ i18n.ts._role._condition.isFromInstance }}</option>
+ <option value="fromBubbleInstance">{{ i18n.ts._role._condition.fromBubbleInstance }}</option>
<option value="isSuspended">{{ i18n.ts._role._condition.isSuspended }}</option>
<option value="isLocked">{{ i18n.ts._role._condition.isLocked }}</option>
<option value="isBot">{{ i18n.ts._role._condition.isBot }}</option>
diff --git a/sharkey-locales/en-US.yml b/sharkey-locales/en-US.yml
index af60fb2a61..0ebc3a9390 100644
--- a/sharkey-locales/en-US.yml
+++ b/sharkey-locales/en-US.yml
@@ -245,6 +245,7 @@ _role:
isFromInstance: "Is from a specific instance"
isFromInstanceHost: "Hostname (case-insensitive)"
isFromInstanceSubdomains: "Match subdomains"
+ fromBubbleInstance: "User is from a bubble instance"
localFollowersLessThanOrEq: "Has X or fewer local followers"
localFollowersMoreThanOrEq: "Has X or more local followers"
localFollowingLessThanOrEq: "Follows X or fewer local accounts"