External projects moderator database (#5692)

* Begin external projects moderator database frontend

* add copy link button

* begin project page permissions settings

* MEL database backend routes

* include filename in external files

* Hook up frontend external license page to backend

* more work on user-facing external projects stuff

* put user-facing stuff behind feature flag

* prepr

* clippy

---------

Co-authored-by: aecsocket <aecsocket@tutanota.com>
This commit is contained in:
Prospector
2026-05-04 09:31:37 -07:00
committed by GitHub
parent 565ac2cb53
commit e13a89dd72
40 changed files with 2099 additions and 95 deletions
+9 -9
View File
@@ -1,6 +1,7 @@
use crate::auth::checks::filter_visible_versions;
use crate::database;
use crate::database::PgPool;
use crate::database::models::DBUserId;
use crate::database::models::notification_item::NotificationBuilder;
use crate::database::models::thread_item::ThreadMessageBuilder;
use crate::database::redis::RedisPool;
@@ -507,6 +508,7 @@ impl AutomatedModerationQueue {
.fetch_all(&pool).await?;
let mut insert_hashes = Vec::new();
let mut insert_filenames = Vec::new();
let mut insert_ids = Vec::new();
for row in rows {
@@ -518,6 +520,7 @@ impl AutomatedModerationQueue {
});
insert_hashes.push(hash.clone().as_bytes().to_vec());
insert_filenames.push(Some(file_name.clone()));
insert_ids.push(row.id);
hashes.remove(index);
@@ -526,16 +529,13 @@ impl AutomatedModerationQueue {
}
if !insert_ids.is_empty() && !insert_hashes.is_empty() {
sqlx::query!(
"
INSERT INTO moderation_external_files (sha1, external_license_id)
SELECT * FROM UNNEST ($1::bytea[], $2::bigint[])
ON CONFLICT (sha1) DO NOTHING
",
&insert_hashes[..],
&insert_ids[..]
crate::database::models::moderation_external_item::ExternalLicense::insert_files(
&pool,
&insert_hashes,
&insert_filenames,
&insert_ids,
DBUserId(0),
)
.execute(&pool)
.await?;
}