File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ pub async fn get(
95
95
id : web:: Path < String > ,
96
96
auth : Auth ,
97
97
) -> Result < impl Responder , ApiError > {
98
+ let dev = auth. developer ( ) . ok ( ) ;
98
99
let mut pool = data
99
100
. db ( )
100
101
. acquire ( )
@@ -110,6 +111,19 @@ pub async fn get(
110
111
. await ?
111
112
. ok_or ( ApiError :: NotFound ( format ! ( "Mod '{id}' not found" ) ) ) ?;
112
113
114
+ let version_statuses = match dev {
115
+ None => Some ( vec ! [ ModVersionStatusEnum :: Accepted ] ) ,
116
+ Some ( d) => {
117
+ if d. admin {
118
+ None
119
+ } else if developers:: has_access_to_mod ( d. id , & the_mod. id , & mut pool) . await ? {
120
+ Some ( vec ! [ ModVersionStatusEnum :: Accepted , ModVersionStatusEnum :: Pending ] )
121
+ } else {
122
+ Some ( vec ! [ ModVersionStatusEnum :: Accepted ] )
123
+ }
124
+ }
125
+ } ;
126
+
113
127
the_mod. tags = mod_tags:: get_for_mod ( & the_mod. id , & mut pool)
114
128
. await ?
115
129
. into_iter ( )
@@ -118,7 +132,7 @@ pub async fn get(
118
132
the_mod. developers = developers:: get_all_for_mod ( & the_mod. id , & mut pool) . await ?;
119
133
the_mod. versions = mod_versions:: get_for_mod (
120
134
& the_mod. id ,
121
- Some ( & [ ModVersionStatusEnum :: Accepted ] ) ,
135
+ version_statuses . as_deref ( ) ,
122
136
& mut pool,
123
137
)
124
138
. await ?;
You can’t perform that action at this time.
0 commit comments