@@ -11,7 +11,7 @@ use crate::database::redis::RedisPool;
11
11
use crate :: database:: { self , models as db_models} ;
12
12
use crate :: file_hosting:: { FileHost , FileHostPublicity } ;
13
13
use crate :: models;
14
- use crate :: models:: ids:: ProjectId ;
14
+ use crate :: models:: ids:: { ProjectId , VersionId } ;
15
15
use crate :: models:: images:: ImageContext ;
16
16
use crate :: models:: notifications:: NotificationBody ;
17
17
use crate :: models:: pats:: Scopes ;
@@ -250,6 +250,8 @@ pub struct EditProject {
250
250
pub monetization_status : Option < MonetizationStatus > ,
251
251
pub side_types_migration_review_status :
252
252
Option < SideTypesMigrationReviewStatus > ,
253
+ #[ serde( flatten) ]
254
+ pub loader_fields : HashMap < String , serde_json:: Value > ,
253
255
}
254
256
255
257
#[ allow( clippy:: too_many_arguments) ]
@@ -870,6 +872,29 @@ pub async fn project_edit(
870
872
. await ?;
871
873
}
872
874
875
+ if !new_project. loader_fields . is_empty ( ) {
876
+ for version in db_models:: DBVersion :: get_many (
877
+ & project_item. versions ,
878
+ & * * pool,
879
+ & redis,
880
+ )
881
+ . await ?
882
+ {
883
+ super :: versions:: version_edit_helper (
884
+ req. clone ( ) ,
885
+ ( VersionId :: from ( version. inner . id ) , ) ,
886
+ pool. clone ( ) ,
887
+ redis. clone ( ) ,
888
+ super :: versions:: EditVersion {
889
+ fields : new_project. loader_fields . clone ( ) ,
890
+ ..Default :: default ( )
891
+ } ,
892
+ session_queue. clone ( ) ,
893
+ )
894
+ . await ?;
895
+ }
896
+ }
897
+
873
898
// check new description and body for links to associated images
874
899
// if they no longer exist in the description or body, delete them
875
900
let checkable_strings: Vec < & str > =
0 commit comments