From 6dbd1e5236312875d69a7861787f1f04e0e58b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= <7822554+AlexTMjugador@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:16:44 +0200 Subject: [PATCH] fix(labrinth): make orgs with a single user and only approved projects visible to non-logged-in people (#4557) I made a typo on PR https://github.com/modrinth/code/pull/4426 by making the corresponding SQL query filter by projects with an unexisting `public` status, instead of `approved`. During my testing, I used the `archived` status, so I didn't notice it back then. --- ...957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a.json} | 4 ++-- apps/labrinth/src/auth/checks.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename apps/labrinth/.sqlx/{query-eb792d5033d7079fe3555593d8731f8853235275e4d5614636b5db524a4920d5.json => query-829a4523233e957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a.json} (73%) diff --git a/apps/labrinth/.sqlx/query-eb792d5033d7079fe3555593d8731f8853235275e4d5614636b5db524a4920d5.json b/apps/labrinth/.sqlx/query-829a4523233e957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a.json similarity index 73% rename from apps/labrinth/.sqlx/query-eb792d5033d7079fe3555593d8731f8853235275e4d5614636b5db524a4920d5.json rename to apps/labrinth/.sqlx/query-829a4523233e957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a.json index ca0b4cf6a..008bd0c24 100644 --- a/apps/labrinth/.sqlx/query-eb792d5033d7079fe3555593d8731f8853235275e4d5614636b5db524a4920d5.json +++ b/apps/labrinth/.sqlx/query-829a4523233e957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT TRUE FROM mods WHERE organization_id = $1 AND status IN ('public', 'archived') LIMIT 1", + "query": "SELECT TRUE FROM mods WHERE organization_id = $1 AND status IN ('approved', 'archived') LIMIT 1", "describe": { "columns": [ { @@ -18,5 +18,5 @@ null ] }, - "hash": "eb792d5033d7079fe3555593d8731f8853235275e4d5614636b5db524a4920d5" + "hash": "829a4523233e957f8876d248a17ec04c245af41f43fa40aff9ee07e893dabf3a" } diff --git a/apps/labrinth/src/auth/checks.rs b/apps/labrinth/src/auth/checks.rs index 380076dc1..f56036df8 100644 --- a/apps/labrinth/src/auth/checks.rs +++ b/apps/labrinth/src/auth/checks.rs @@ -377,7 +377,7 @@ pub async fn is_visible_organization( // This is meant to match the same projects as the `Project::is_searchable` method, but we're not using // it here because that'd entail pulling in all projects for the organization let has_searchable_projects = sqlx::query_scalar!( - "SELECT TRUE FROM mods WHERE organization_id = $1 AND status IN ('public', 'archived') LIMIT 1", + "SELECT TRUE FROM mods WHERE organization_id = $1 AND status IN ('approved', 'archived') LIMIT 1", organization.id as database::models::ids::DBOrganizationId ) .fetch_optional(pool)