Skip to content

Redirect MuckRock Accounts UUIDs to document searches - #1446

Merged
allanlasser merged 3 commits into
mainfrom
allanlasser/cross-service-profile-links
Oct 27, 2026
Merged

allanlasser merged 3 commits into
mainfrom
allanlasser/cross-service-profile-links

Conversation

@allanlasser

@allanlasser allanlasser commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Adds UUID redirect routes that land on a search for a user's or organization's documents, so MuckRock Accounts profile cards can link here, for MuckRock/squarelet#849.

Companion PRs: MuckRock/squarelet#882, MuckRock/muckrock#2313

Will merge the two client-app PRs first, then the one that builds the URLs on Accounts.

Behaviour changes

  • /users/uuid/<uuid>/ looks up the user and redirects to /documents/?q=user:<id>.
  • /organizations/uuid/<uuid>/ looks up the organization and redirects to /documents/?q=organization:<id>.
  • Logged-out visitors are sent to sign in, then back, because /api/users/ and /api/organizations/ require a login. This is ok, since we expect people will access from a signed-in MuckRock Accounts session.
  • A uuid the viewer can't see, or that doesn't exist, is a 404. The viewer can see a user when they have a public document or share an organization or project with the viewer.
  • Adds uuid to listUsers/listOrgs params and an orgDocs() search helper. No backend change; the uuid filters already exist.

Migrations

  • None.

What to check

  • Get a user and org UUID from https://staging-accounts.muckrock.com/
  • Logged in, /users/uuid/<your uuid>/ lands on a search for your documents.
  • Logged in, /organizations/uuid/<an org uuid>/ lands on a search for that organization's documents.
  • Logged out, either route goes through sign-in and comes back to the search.
  • A random uuid shows the 404 page.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MgSHjTBX3NVeqjfAzJAedj

/documents/users/<uuid>/ and /documents/organizations/<uuid>/ look up
the user or organization and redirect to a search for their documents,
so MuckRock Accounts can link to them. Logged-out visitors sign in first,
since the lookup requires a login.

Refs MuckRock/squarelet#849

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgSHjTBX3NVeqjfAzJAedj
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Preview removed.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 53.65% 4284 / 7984
🔵 Statements 52.22% 5035 / 9641
🔵 Functions 47.24% 1612 / 3412
🔵 Branches 50.58% 2218 / 4385
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/api/accounts.ts 89.04% 91.66% 95.23% 88.88% 216-238
src/lib/utils/search.ts 73.07% 60% 88.23% 80% 14, 23, 74, 81, 122, 129, 136, 143-153
src/routes/(redirects)/organizations/uuid/[uuid]/+server.ts 91.66% 90% 100% 91.66% 25
src/routes/(redirects)/users/uuid/[uuid]/+server.ts 91.66% 90% 100% 91.66% 25
Generated in workflow #1440 for commit 14c6e81 by the Vitest Coverage Report Action

@allanlasser
allanlasser requested a review from eyeseast October 26, 2026 20:09
@allanlasser
allanlasser marked this pull request as ready for review October 26, 2026 20:09
@eyeseast

Copy link
Copy Markdown
Collaborator

I think https://squarelet-staging.herokuapp.com/ is the old staging url. Should be https://staging-accounts.muckrock.com/.

@eyeseast

Copy link
Copy Markdown
Collaborator

Everything works. I think we should change two things:

  • move the routes under (redirects) since that's what they are
  • rewrite them as GET functions in server.ts files, since they'll only ever be server calls

They only ever redirect, so they don't need a page. An expired session
now goes to sign-in instead of an error page.

Refs MuckRock/squarelet#849

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgSHjTBX3NVeqjfAzJAedj

This comment was marked as low quality.

@allanlasser
allanlasser merged commit bb4ec71 into main Oct 27, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants