Repository navigation
fix(plugin-list): offer the In a queue toggle only when the organization has a queue - #28889
Merged
Merged
Conversation
…ion has a queue The list toolbar now shows the toggle when the object carries the platform's queue column AND the session's /auth/me/permissions answer says hasAnyQueue. @object-ui/permissions hands that boolean on through one optional PermissionContextValue member; an unknown answer hides the toggle. No new request on list mount. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUddMTB1CyxjzoKGxi
Contributor
Author
|
domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu 席位核对 · ACCEPT · 2026-11-02T03:43ZHead-sha:
|
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28428
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
queue字段,且当前会话的/auth/me/permissions回答hasAnyQueue: true(组织至少有一个队列)。@object-ui/permissions的上下文新增一个可选成员hasAnyQueue,把服务端这个布尔值原样传下去。queue字段,所以没有任何队列的组织(如 app-crm、HotCRM)每个列表都显示这个开关,点了永远是空列表。按 List toolbar: offer the "In a queue" toggle only when the organization has at least one queue — today every owned object shows it, and in an app with no queues it always returns an empty list #28428 的裁定 A,服务端已在 Session payload: the console learns once per session whether the caller's organization has at least one ownership queue (declared orsys_queue), with no widening of member read onsys_queue#28508 提供该布尔值。ui/packages/plugin-list/src/ListView.tsx(queueFilterOffered)、ui/packages/permissions/src/MePermissionsProvider.tsx(hasAnyQueue)、ui/packages/permissions/src/PermissionContext.ts。cd ui && pnpm exec vitest run packages/plugin-list/src/__tests__/ListView.queueSittingFilter-25769.test.tsx packages/permissions/src/__tests__/hasAnyQueue-28428.test.tsx,预期 18 个用例全绿。What changes
@object-ui/permissions:PermissionContextValuegains one optional member,hasAnyQueue?: boolean.MePermissionsProvidersets it from the authenticated/auth/me/permissionsanswer (Session payload: the console learns once per session whether the caller's organization has at least one ownership queue (declared orsys_queue), with no widening of member read onsys_queue#28508). It isundefinedwith no answer: the anonymous answer, the role-basedPermissionProvider, and no provider at all (usePermissions' no-provider literal).ServerReadScopeandRecordFieldAccessScopespread their parent, so they forward it unchanged.@object-ui/plugin-list:queueFilterOfferedis nowhasAnyQueue === true && objectHasOwnershipQueue(objectDef). The flag rides the permissions answer the console already holds, so opening a list reads no queue list and sends no new request.MePermissionsProviderrenders its loading fallback until the payload arrives, so a list never sees a pending flag there. Elsewhere (no provider, the role-based provider, an anonymous session) nothing can show a queue exists, so the toggle stays hidden.Why
Route A ruling 6553134732 on #28428: offer the toggle when the object carries the
queuefield AND the session's has-queues boolean is true. In an organization with no queue, the toggle could only return an empty list.Tests
ListView.queueSittingFilter-25769.test.tsx: the existing cases now mount under a session double (MePermissionsProviderwithhasAnyQueue: true) and still pass. New cases: no queue gives no toggle even on an object with the injected column; one queue gives the toggle; an unknown answer (no provider, anonymous) gives no toggle; a list mount makes the same data-source calls with and without a queue, everyfindtargets the listed object, andfetchis never called.hasAnyQueue-28428.test.tsxin@object-ui/permissions: the truth table (servedtrueandfalse, anonymous, forwarded throughServerReadScope, role-based provider, no provider).scripts/ablation-replace.mjswith the blob restored to HEAD afterwards:(hasAnyQueue === true || true) && …): 2 red, "no queue" and "unknown answer".hasAnyQueue: undefined): 3 red, servedtrue, servedfalse, scope forwarding.Acceptance notes
Measured on a production console build (
turbo run build,pnpm console:build),pnpm dev:crm -- --fresh, admin, at headc0b35cd6:/auth/me/permissionshasAnyQueuecrm_accountlistcrm_contactlistfalsesys_queuerow inserted (201)truefalsecrm_accountserves the injectedqueuecolumn (system: true, hidden), so the old rule would have shown the toggle there.GET /api/v1/data/crm_account?…&filter=["and",["owner_id","is_empty",true],["queue","is_not_empty",true]], the same filter as before.sys_user_preferencePATCH that comes and goes with timing in either state. No request in any run named a queue.hasAnyQueue: falseand the same result. It was not run here: it lives in another repository.issue-28428/.Verification
Local runs at head c0b35cd
pnpm exec vitest run packages/plugin-list/(fromui/): Test Files 179 passed, Tests 1727 passed.pnpm exec vitest run packages/permissions/: Test Files 16 passed, Tests 172 passed.pnpm --dir ui exec vitest run scripts/: Test Files 169 passed, 2 skipped; Tests 4900 passed, 2 skipped.turbo run type-check --filter=@object-ui/plugin-list --filter=@object-ui/permissions: 51 of 51 tasks successful.node scripts/pm/dispatch-gates.mjs --commands: 34 commands, all exit 0 (33 in one loop, plus the uiscripts/suite above), includingcheck-sdui-manifest.mjs,check-changeset-no-major.mjs --base origin/main,check-adr-0087-registration.mjs,check:published-files,check:nul-bytes.Human Minimum
packages/specholds no runtime logic. (packages/specnot touched.)pnpm lintis CI's run.main, one pull request.packages/spectouched: not applicable.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUddMTB1CyxjzoKGxi
Generated by Claude Code