[pull] main from tldraw:main#579
Merged
Merged
Conversation
In order to let an admin turn the groups experience on for a specific user, this PR adds an "Enroll in groups" action to the `/admin` page that grants both groups flags. Closes #9062. The page previously only had a single-user "Migrate to Groups" control that was hidden unless you'd searched a user lacking `groups_backend`, and it only granted `groups_backend` — never `groups_frontend`, the flag that actually shows the groups UI (otherwise only granted on accepting a group invite). So there was no usable way to enroll a specific user into the groups experience. This replaces that control with an always-visible (per found user) "Groups enrollment" block that shows the user's current `groups_backend` / `groups_frontend` status and an "Enroll in groups" button. The button calls a new admin endpoint `POST /app/admin/user/enroll_groups` (behind the existing `@tldraw.com` admin gate), which runs `admin_enrollInGroups`: migrate the data model if needed (idempotent `migrate_user_to_groups`) and add `groups_frontend`, then reboot the user so it takes effect. It reports what changed and is safe to re-run. The existing batch migration and `POST /app/admin/user/migrate` are unchanged. ### Change type - [x] `improvement` ### Test plan 1. Sign in to a local/staging dotcom with an `@tldraw.com` account and open `/admin`. 2. Enter a user's email or id → **Find User**. 3. In **User Data**, the **Groups enrollment** block shows `groups_backend ✓/✗ · groups_frontend ✓/✗`. 4. For a user lacking `groups_frontend` (e.g. a freshly created account — new users get `groups_backend` by default but not `groups_frontend`), click **Enroll in groups** → confirm. The status flips to both ✓, and the groups UI appears for that user on their next load. 5. Re-running on an already-enrolled user reports "already fully enrolled" (idempotent). ### Code changes | Section | LOC change | | ------- | ---------- | | Apps | +101 / -21 |
#9018) 👩: this also has the nice effect of removing a hardcoded reference to the select tool from `editor` and moving it up into `tldraw` --- In order to keep `@tldraw/editor` free of concrete default overlay utils, this PR moves `ShapeIndicatorOverlayUtil` (and its `TLShapeIndicatorOverlay` type) out of the editor package and into `tldraw`, where every other built-in overlay util already lives (`BrushOverlayUtil`, `ScribbleOverlayUtil`, `ShapeHandleOverlayUtil`, and the rest). `ShapeIndicatorOverlayUtil` was the lone concrete overlay util still defined in the editor package; after this change `defaultOverlayUtils` is assembled entirely from tldraw-local utils, and the editor package keeps only the abstractions: the `OverlayUtil` base class and the `strokeShapeIndicators` helper. The `strokeShapeIndicators` helper stays in `@tldraw/editor` — it depends only on `ShapeUtil.getIndicatorPath` and is shared by other indicator overlays (e.g. `CollaboratorShapeIndicatorOverlayUtil`). It's been extracted into its own `strokeShapeIndicators.ts` module so the moved class can import it from the editor. For consumers importing from `'tldraw'`, nothing changes — `ShapeIndicatorOverlayUtil` and `TLShapeIndicatorOverlay` are still exported from there. Only code importing those two symbols directly from `'@tldraw/editor'` needs to update its import path. The `defaultOverlayUtils` array is also reordered alphabetically. This is cosmetic: registration order only breaks ties between utils with equal `zIndex`, and every overlay util has a distinct `zIndex`, so paint and hit-test order are unchanged. This PR also tidies the `indicators-logic` example: the four geo shapes are given a clearer layout (an ellipse and a text shape are added), the two bottom-left shapes are grouped on mount to show indicators on a group, and the README explains what shape indicators are. ### Change type - [x] `api` ### Test plan 1. Open the `indicators-logic` example; confirm indicators are drawn around every shape, including the grouped pair in the bottom left and the group itself. 2. In any default tldraw editor, confirm selection and hover indicators still render and hit-test correctly (selection, brushing, handles). 3. Confirm `import { ShapeIndicatorOverlayUtil, TLShapeIndicatorOverlay } from 'tldraw'` resolves. - [x] Unit tests ### Release notes - Move `ShapeIndicatorOverlayUtil` and `TLShapeIndicatorOverlay` from `@tldraw/editor` to `tldraw`. They remain exported from `tldraw`; update any direct `@tldraw/editor` imports of these two symbols. ### API changes `@tldraw/editor`: - Breaking! Removed `ShapeIndicatorOverlayUtil` (moved to `tldraw`). - Breaking! Removed `TLShapeIndicatorOverlay` (moved to `tldraw`). - `strokeShapeIndicators` is unchanged and still exported (now from its own module). `tldraw`: - Added `ShapeIndicatorOverlayUtil` (moved from `@tldraw/editor`). - Added `TLShapeIndicatorOverlay` (moved from `@tldraw/editor`). - `defaultOverlayUtils` now references the tldraw-local `ShapeIndicatorOverlayUtil`; its entries are reordered alphabetically (behavior-preserving, since all z-indices are distinct). ### Code changes | Section | LOC change | | --------------- | ---------- | | Core code | +108 / -107 | | Automated files | +28 / -29 | | Documentation | +19 / -6 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )