Skip to content

split project visibility and review status - #8372

Closed
aecsocket wants to merge 7 commits into
mainfrom
boris/project-status-split
Closed

aecsocket wants to merge 7 commits into
mainfrom
boris/project-status-split

Conversation

@aecsocket

Copy link
Copy Markdown
Contributor

Also introduces project_history to track status changes

@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 18, 2026 •

Copy link
Copy Markdown

This pull request is closed, so it cannot be queued. Reopen it to get the box back.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 2/5

[High impact] The change reaches project state across editing, moderation, and public discovery.

Do not merge until the backend builds, the creation-history test uses accepted input, existing v2 writes keep working, and the formatting requirement is met.

Summary

This PR separates project visibility from review status and adds a history of project changes.

  • Project records now keep visibility and moderation review as separate states.
  • Project changes now leave a history of who changed what.
  • Review decisions now use a separate action and can include a reason.
  • Project visibility settings now control audience without changing review progress.

Before merging, fix the missing query metadata, the creation-history test input, existing v2 status writes, and the required Rust formatting.

Reviews (1) · Last reviewed commit: "add project deletion records" · Reviewed by Greptile

Comment on lines +474 to +478
sqlx::query!(
r#"
INSERT INTO project_history (project_id, done_by, occurred_at, delta)
VALUES ($1, $2, clock_timestamp(), $3)
"#,

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 Offline builds cannot compile. The new queries have no matching files in .sqlx; for example, none contains this project_history insert. The build workflow sets SQLX_OFFLINE=true, so these sqlx::query! calls fail during compilation. Regenerate and commit the query metadata for the changed queries.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/database/models/project_item.rs
Line: 474-478

Comment:
**Offline builds cannot compile.** The new queries have no matching files in `.sqlx`; for example, none contains this `project_history` insert. The build workflow sets `SQLX_OFFLINE=true`, so these `sqlx::query!` calls fail during compilation. Regenerate and commit the query metadata for the changed queries.

---

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

Comment thread apps/labrinth/tests/project.rs Outdated
.api
.get_public_project_creation_data_json(&slug, None)
.await;
request_data["visibility"] = json!(visibility);

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 Creation history test always fails. This test sends visibility, but both multipart creation inputs still accept only requested_status. They ignore visibility and default to approved, which stores listed. The unlisted iteration therefore fails its state and history assertions. Send requested_status here, mapping listed to approved, or add support for visibility to both creation routes.

Knowledge Base Used: Project and version workflows

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/tests/project.rs
Line: 873

Comment:
**Creation history test always fails.** This test sends `visibility`, but both multipart creation inputs still accept only `requested_status`. They ignore `visibility` and default to `approved`, which stores `listed`. The `unlisted` iteration therefore fails its state and history assertions. Send `requested_status` here, mapping `listed` to `approved`, or add support for `visibility` to both creation routes.

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

---

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

Comment on lines 578 to +579
pub slug: Option<String>,
pub status: Option<ProjectStatus>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "::serde_with::rust::double_option"
)]
pub requested_status: Option<Option<ProjectStatus>>,
pub visibility: Option<crate::models::projects::ProjectVisibility>,

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 Existing v2 status writes disappear. Removing status and requested_status makes established PATCH requests silently do nothing. For example, an owner sending {"status":"private"} for an approved project still gets success, but the project stays public. API v2 promises long-term support. Keep these fields in the v2 adapter and translate them into the new visibility and review operations.

Knowledge Base Used: Backend API and authentication

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/routes/v2/projects.rs
Line: 578-579

Comment:
**Existing v2 status writes disappear.** Removing `status` and `requested_status` makes established PATCH requests silently do nothing. For example, an owner sending `{"status":"private"}` for an approved project still gets success, but the project stays public. API v2 promises long-term support. Keep these fields in the v2 adapter and translate them into the new visibility and review operations.

**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 +612 to +619
db_models::DBProject::update_visibility(
id,
visibility,
Some(user.user.id.into()),
&mut transaction,
)
.execute(&mut transaction)
.await
.wrap_internal_err("querying database for `project_edit_internal`")?;
.wrap_internal_err("updating project visibility")?;

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 First public announcements are skipped. An approved private or unlisted project can become listed through this visibility PATCH. The old status-edit path sent its first Discord announcement then, but that code now exists only in the review-state endpoint. The review status does not change when the owner publishes, so the announcement is never sent. Run the announcement check when a visibility edit first makes an approved project listed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/routes/v3/projects/mod.rs
Line: 612-619

Comment:
**First public announcements are skipped.** An approved private or unlisted project can become listed through this visibility PATCH. The old status-edit path sent its first Discord announcement then, but that code now exists only in the review-state endpoint. The review status does not change when the owner publishes, so the announcement is never sent. Run the announcement check when a visibility edit first makes an approved project listed.

---

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 18, 2026 •

Copy link
Copy Markdown
Contributor

Frontend previews

Last deployed commit is bf296e83d56dcbd0277ebcb6dee55307abd68f89

Persistent

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

Latest commit

Environment URL
staging https://ab3d80a7.frontend-staging.rinth.dev
production https://fa954cf9.frontend.rinth.dev

@aecsocket

Copy link
Copy Markdown
Contributor Author

Closing in favour of #8393 since the original design for this isn't very good

@aecsocket aecsocket closed this Nov 19, 2026
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