Repository navigation
Conversation
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
This pull request is closed, so it cannot be queued. Reopen it to get the box back. |
[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.
|
| sqlx::query!( | ||
| r#" | ||
| INSERT INTO project_history (project_id, done_by, occurred_at, delta) | ||
| VALUES ($1, $2, clock_timestamp(), $3) | ||
| "#, |
There was a problem hiding this 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.
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.| .api | ||
| .get_public_project_creation_data_json(&slug, None) | ||
| .await; | ||
| request_data["visibility"] = json!(visibility); |
There was a problem hiding this 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
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.| 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>, |
There was a problem hiding this 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
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.| 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")?; |
There was a problem hiding this 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.
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.
Frontend previewsLast deployed commit is bf296e83d56dcbd0277ebcb6dee55307abd68f89 Persistent
Latest commit
|
|
Closing in favour of #8393 since the original design for this isn't very good |
Also introduces
project_historyto track status changes