Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import type { ChatMemberRole } from "./types.js";
|
||||
|
||||
export type ChatMemberRoleSources = Readonly<{
|
||||
isManualMember: boolean;
|
||||
manualRoleInChat: ChatMemberRole | null;
|
||||
isProjectManaged: boolean;
|
||||
projectRoleInChat: ChatMemberRole | null;
|
||||
isGroupManaged: boolean;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Resolve the materialized role from independent membership grants. Manual
|
||||
* and project sources carry roles; a permission-group source always grants a
|
||||
* regular member role. A source-less history row deliberately falls back to
|
||||
* member so a former project lead never keeps an effective admin role.
|
||||
*/
|
||||
export function resolveEffectiveChatMemberRole(sources: ChatMemberRoleSources): ChatMemberRole {
|
||||
if (sources.isManualMember && sources.manualRoleInChat === "admin") return "admin";
|
||||
if (sources.isProjectManaged && sources.projectRoleInChat === "admin") return "admin";
|
||||
return "member";
|
||||
}
|
||||
|
||||
export function hasActiveChatMembershipSource(sources: ChatMemberRoleSources): boolean {
|
||||
return sources.isManualMember || sources.isProjectManaged || sources.isGroupManaged;
|
||||
}
|
||||
Reference in new issue
Block a user