Skip to content

Staff hub for featured collections - #8522

Open
Prospector wants to merge 7 commits into
mainfrom
prospector/featured-collections-hub
Open

Prospector wants to merge 7 commits into
mainfrom
prospector/featured-collections-hub

Conversation

@Prospector

Copy link
Copy Markdown
Member

No description provided.

@Prospector Prospector changed the title prospector/featured-collections-hub Staff hub for featured collections Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Nov 30, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 2/5 · Fix private creation and shared collection overwrites before merging.RetriggerView in GreptileConfidence Score: 2/5

[Medium impact] The changes affect staff collection workflows and project data returned by the API.

Fix private creation and shared collection overwrites before merging.

Summary

Adds a staff hub for featured collections, project-level feature controls, POTW creation, bulk edits, and collection copying. The backend adds collection flags and featured_in to project responses.

  • Moderators manage featured collections from one staff hub.
  • Staff can change a project’s featured collection membership from project pages.
  • The API stores collection flags and returns featured collection IDs with projects.

Review used source inspection. No runtime or visual verification was performed.

Reviews (1) · Last reviewed commit: "featured collections staff page" · Reviewed by Greptile

Comment on lines +338 to +343
if (input.status !== 'listed') {
try {
await client.labrinth.collections.edit(collection.id, { status: input.status })
} catch (error) {
warnings.push(`Could not save visibility. ${collectionErrorMessage(error)}`)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Private collections start public

Choosing Private when creating a POTW collection still sends its projects to collections.create, which always creates a listed collection. Anyone can find it through the Modrinth account's collections and read its contents before the later visibility update. If that update fails, the collection stays public because the error only adds a warning.

Accept and save the chosen visibility in the creation request, before exposing any contents.

How this was verified: Collection creation commits Listed with the selected projects, and anonymous collection reads allow listed collections before the separate visibility update.

Knowledge Base Used: Backend API and authentication

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/frontend/src/components/ui/moderation/StaffCollectionCreateModal.vue
Line: 338-343

Comment:
**Private collections start public**

Choosing Private when creating a POTW collection still sends its projects to `collections.create`, which always creates a listed collection. Anyone can find it through the Modrinth account's collections and read its contents before the later visibility update. If that update fails, the collection stays public because the error only adds a warning.

Accept and save the chosen visibility in the creation request, before exposing any contents.

**How this was verified:** Collection creation commits `Listed` with the selected projects, and anonymous collection reads allow listed collections before the separate visibility update.

**Knowledge Base Used:** [Backend API and authentication](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Fbackend-api-auth.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +189 to +191
mutationFn: async (collection: Labrinth.Collections.Collection) => {
const projects = nextProjects(collection)
await client.labrinth.collections.edit(collection.id, { new_projects: projects })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Staff changes overwrite each other

toggleProject replaces the whole collection using the list loaded by that page. If two moderators open different projects and add them to the same collection, the second save can remove the first moderator's addition. This can happen even when the saves happen one after another, since the second page still holds the old list.

The new add/remove helpers use the same read-then-replace pattern. Add server-side operations that change only the requested project IDs, or reject edits based on an outdated collection.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/frontend/src/components/ui/moderation/ProjectFeatureButton.vue
Line: 189-191

Comment:
**Staff changes overwrite each other**

`toggleProject` replaces the whole collection using the list loaded by that page. If two moderators open different projects and add them to the same collection, the second save can remove the first moderator's addition. This can happen even when the saves happen one after another, since the second page still holds the old list.

The new add/remove helpers use the same read-then-replace pattern. Add server-side operations that change only the requested project IDs, or reject edits based on an outdated collection.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +510 to +518
let refresh_projects = featured_project_cache_ids(
collection_item.status,
collection_item.flags,
&collection_item.projects,
new_collection.status.unwrap_or(collection_item.status),
new_collection
.collection_flags
.unwrap_or(collection_item.flags),
&next_projects,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Featured status can stay stale

The refresh list uses collection_item, which was read before the transaction. A concurrent edit can add a project that this request never sees. For example, one request reads an empty featured collection, another adds a project, and the first then makes the collection private. The first request clears no project caches, so a project cached between those saves keeps the collection in featured_in.

Read the current collection and its members under a shared write lock before changing them and calculating which caches to clear.

Knowledge Base Used: Backend data storage

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/routes/v3/collections.rs
Line: 510-518

Comment:
**Featured status can stay stale**

The refresh list uses `collection_item`, which was read before the transaction. A concurrent edit can add a project that this request never sees. For example, one request reads an empty featured collection, another adds a project, and the first then makes the collection private. The first request clears no project caches, so a project cached between those saves keeps the collection in `featured_in`.

Read the current collection and its members under a shared write lock before changing them and calculating which caches to clear.

**Knowledge Base Used:** [Backend data storage](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Fbackend-data-storage.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Frontend previews

Last deployed commit is 7593efa405a96625286d2cfb4fe6e486d0e015d2

Persistent

Environment URL
staging https://pr-8522.frontend-staging.rinth.dev
production https://pr-8522.frontend.rinth.dev
storybook https://pr-8522-storybook.modrinth.workers.dev

Latest commit

Environment URL
staging https://549bcfbe.frontend-staging.rinth.dev
production https://856ca97b.frontend.rinth.dev

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant