feat: show full world settings modal for world-wide collaborators - #1417
feat: show full world settings modal for world-wide collaborators#1417decentraland-bot wants to merge 2 commits into
Conversation
World-wide collaborators (those with deployment rights for the entire world, not just specific parcels) can now access the Details, Layout, and General tabs in the World Settings modal and save changes. Previously only owners could see all tabs. Now `canEditSettings` is derived from the existing parcel-permission data: an empty `parcels` array after a succeeded fetch signals world-wide access, matching the same pattern already used in LayoutTab for unpublish visibility. A brief loading state is shown while parcel permissions are fetched to avoid a flash from the restricted to the full modal. Closes #1416 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test this pull request on windows-latestDownload the correct version for your architecture: |
Test this pull request on macos-latestDownload the correct version for your architecture:Click here if you don't know which version to downloadFor running this unsigned version of the app, you will need to run the xattr command on it:
|
nicoecheza
left a comment
There was a problem hiding this comment.
The change is correctly scoped and the "empty parcels + succeeded = world-wide" inference follows the existing convention (LayoutTab, PublishToWorld). Parcel-only collaborators and owners are unaffected — verified against both neighbors. One real issue before merge:
Failed parcels fetch is indistinguishable from world-wide access. fetchParcelsPermission returns null on any non-OK response (lib/worlds.ts:531-536), the thunk fulfills with parcels: null (management/slice.ts:408-409), and the fulfilled reducer stores { parcels: [], status: 'succeeded' } (slice.ts:634-640). A parcel-only collaborator whose parcels request hits a transient 500/429 (see the TODO about the parallel pagination overloading the API) now gets the full settings editor, edits, and Save fails server-side with only a generic snackbar (putWorldSettings only extracts an error body for status 400). This bug predates the PR — but the PR raises its blast radius from one menu item to the whole editor. The clean fix is in the thunk: reject (or store failed) when the first page is null, rather than fulfilling.
Minor:
- The flash-prevention is partial:
.Collaborator(740px) vs full modal (900px) means a world-wide collaborator's modal opens narrow with no tabs, then snaps wide when the fetch resolves. Consider gating the width class onisEffectivelyLoadingtoo. - This is now the third copy of the world-wide inference — extracting a
hasWorldWidePermission(parcelsPermission)helper/selector would make it unit-testable and keep the three sites from drifting (there's currently no test for the null-first-page →succeeded+[]path that drives this gate). - Has a save by a real world-wide collaborator been verified end-to-end against the worlds content server? The whole feature rides on that authorization; worth one manual pass before merge if not done already.
Summary
Plan
Root Cause
In
WorldSettingsModal/component.tsx,showTabswas hard-coded toisOwner, hiding all tabs for any non-owner. The distinction between world-wide and parcel-only collaborators was already computable from existing Redux state:fetchParcelsPermissionreturns{ parcels: [], status: 'succeeded' }when a user has world-wide access (the server omits parcels for world-wide grants). This same pattern is already used inLayoutTabto show the "Unpublish" dropdown for world-wide collaborators.The server already accepts
PUT /world/{worldName}/settingsfrom world-wide collaborators (confirmed by @LautaroPetaccio) — the restriction was UI-only.Relevant Files
packages/creator-hub/renderer/src/components/Modals/WorldSettingsModal/component.tsx— changed (3 lines)packages/creator-hub/renderer/src/components/Modals/WorldSettingsModal/tabs/LayoutTab/component.tsx:76— pattern reference (empty parcels = world-wide, already correct)packages/creator-hub/renderer/src/modules/store/management/slice.ts:32—ParcelsPermissiontype unchangedProposed Changes (all in
WorldSettingsModal/component.tsx)isWorldWideCollaboratorfromuserParcelsPermissions(empty parcels + succeeded status)canEditSettings = isOwner || isWorldWideCollaboratorshowTabs={isOwner}→showTabs={canEditSettings}CollaboratorCSS class condition from!isOwner→!canEditSettingsisEffectivelyLoadingto cover parcel-fetch loading state (prevents Layout-only flash)Changes
Testing
Closes
#1416
🤖 Created via Slack with Claude
Requested by Nico Earnshaw (<@UB4ENQ750>)