feat(protocol): read current group admin settings
Group detail and ext-info can now return the join option, search flags, invite/permission/history bits, and robot-add switch so setters have a matching read path.
This commit is contained in:
13 files changed
+284
-2
No files matched your search
@@ -6,6 +6,7 @@ import type { Oidb0x89a_0InvitePolicy } from '@snowluma/proto-defs/oidb-actions/
|
||||
|
||||
import {
|
||||
MEMBER_INVITE_PRIVILEGE_MASK,
|
||||
decodeMemberInvitePolicy,
|
||||
mergeMemberInvitePrivilegeFlag,
|
||||
SetMemberInvitePolicy,
|
||||
type GroupMemberInvitePolicy,
|
||||
@@ -55,6 +56,27 @@ describe('SetMemberInvitePolicy namespace', () => {
|
||||
.toBe(0xE1000001);
|
||||
});
|
||||
|
||||
it.each<[number, GroupMemberInvitePolicy]>([
|
||||
[0x04000000, 'disabled'],
|
||||
[0, 'require_approval'],
|
||||
[0x00100000, 'no_approval'],
|
||||
[0x02000000, 'no_approval_under_100'],
|
||||
[0x80100001, 'no_approval'],
|
||||
[0x84000001, 'disabled'],
|
||||
])('decodes privilege %# as %s', (privilegeFlag, policy) => {
|
||||
expect(decodeMemberInvitePolicy(privilegeFlag)).toBe(policy);
|
||||
});
|
||||
|
||||
it('round-trips each invite policy through merge then decode', () => {
|
||||
const policies: GroupMemberInvitePolicy[] = [
|
||||
'disabled', 'require_approval', 'no_approval', 'no_approval_under_100',
|
||||
];
|
||||
for (const policy of policies) {
|
||||
expect(decodeMemberInvitePolicy(mergeMemberInvitePrivilegeFlag(0x80000001, policy)))
|
||||
.toBe(policy);
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps explicit zero fields on the wire', async () => {
|
||||
const sender = makeSender();
|
||||
await SetMemberInvitePolicy.invoke(sender, {
|
||||
|
||||
Reference in new issue
Block a user