summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-10 13:04:03 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-12 13:31:16 -0400
commit655290f8a496fbda1aa66f3de1e33cdefe08aa00 (patch)
treeae98662f89c848dd1456eca21f811203d20bc72c /packages/backend/src
parentmerge: Make muted post placeholders look clickable (resolves #502) (!1019) (diff)
downloadsharkey-655290f8a496fbda1aa66f3de1e33cdefe08aa00.tar.gz
sharkey-655290f8a496fbda1aa66f3de1e33cdefe08aa00.tar.bz2
sharkey-655290f8a496fbda1aa66f3de1e33cdefe08aa00.zip
add "is from local bubble instance" role condition
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/RoleService.ts4
-rw-r--r--packages/backend/src/models/Role.ts8
2 files changed, 12 insertions, 0 deletions
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 |