@@ -439,7 +439,7 @@ impl PostService {
439
439
/// This should never ever panic. If it does, create a bug report.
440
440
#[ allow( clippy:: too_many_lines) ]
441
441
pub async fn create ( & self , create_post : CreatePost ) -> Result < Post > {
442
- create_post. validate ( & PostValidationContext {
442
+ create_post. validate_with ( & PostValidationContext {
443
443
character_limit : self . instance_service . character_limit ( ) ,
444
444
} ) ?;
445
445
@@ -579,7 +579,7 @@ impl PostService {
579
579
. get_post_with_access_guard ( update_post. post_id , update_post. account_id , None )
580
580
. await ?;
581
581
582
- update_post. validate ( & PostValidationContext {
582
+ update_post. validate_with ( & PostValidationContext {
583
583
character_limit : self . instance_service . character_limit ( ) ,
584
584
} ) ?;
585
585
@@ -909,7 +909,7 @@ impl PostService {
909
909
& self ,
910
910
get_favourites : GetAccountsInteractingWithPost ,
911
911
) -> Result < impl Stream < Item = Result < Account > > + ' _ > {
912
- get_favourites. validate ( & LimitContext :: default ( ) ) ?;
912
+ get_favourites. validate_with ( & LimitContext :: default ( ) ) ?;
913
913
914
914
let mut query = posts_favourites:: table
915
915
. inner_join ( accounts:: table. on ( posts_favourites:: account_id. eq ( accounts:: id) ) )
@@ -947,7 +947,7 @@ impl PostService {
947
947
& self ,
948
948
get_reblogs : GetAccountsInteractingWithPost ,
949
949
) -> Result < impl Stream < Item = Result < Account > > + ' _ > {
950
- get_reblogs. validate ( & LimitContext :: default ( ) ) ?;
950
+ get_reblogs. validate_with ( & LimitContext :: default ( ) ) ?;
951
951
952
952
let permission_check = PermissionCheck :: builder ( )
953
953
. fetching_account_id ( get_reblogs. fetching_account_id )
@@ -1166,17 +1166,17 @@ mod test {
1166
1166
. build ( ) ;
1167
1167
1168
1168
assert ! ( create_post
1169
- . validate ( & PostValidationContext {
1169
+ . validate_with ( & PostValidationContext {
1170
1170
character_limit: 20 ,
1171
1171
} )
1172
1172
. is_ok( ) ) ;
1173
1173
1174
1174
assert ! ( create_post
1175
- . validate ( & PostValidationContext { character_limit: 5 } )
1175
+ . validate_with ( & PostValidationContext { character_limit: 5 } )
1176
1176
. is_err( ) ) ;
1177
1177
1178
1178
assert ! ( create_post
1179
- . validate ( & PostValidationContext { character_limit: 2 } )
1179
+ . validate_with ( & PostValidationContext { character_limit: 2 } )
1180
1180
. is_err( ) ) ;
1181
1181
1182
1182
let create_post = CreatePost :: builder ( )
@@ -1185,7 +1185,7 @@ mod test {
1185
1185
. build ( ) ;
1186
1186
1187
1187
assert ! ( create_post
1188
- . validate ( & PostValidationContext {
1188
+ . validate_with ( & PostValidationContext {
1189
1189
character_limit: 25
1190
1190
} )
1191
1191
. is_err( ) ) ;
@@ -1197,7 +1197,7 @@ mod test {
1197
1197
. build ( ) ;
1198
1198
1199
1199
assert ! ( create_post
1200
- . validate ( & PostValidationContext {
1200
+ . validate_with ( & PostValidationContext {
1201
1201
character_limit: 25
1202
1202
} )
1203
1203
. is_ok( ) ) ;
@@ -1213,17 +1213,17 @@ mod test {
1213
1213
. build ( ) ;
1214
1214
1215
1215
assert ! ( update_post
1216
- . validate ( & PostValidationContext {
1216
+ . validate_with ( & PostValidationContext {
1217
1217
character_limit: 20 ,
1218
1218
} )
1219
1219
. is_ok( ) ) ;
1220
1220
1221
1221
assert ! ( update_post
1222
- . validate ( & PostValidationContext { character_limit: 5 } )
1222
+ . validate_with ( & PostValidationContext { character_limit: 5 } )
1223
1223
. is_err( ) ) ;
1224
1224
1225
1225
assert ! ( update_post
1226
- . validate ( & PostValidationContext { character_limit: 2 } )
1226
+ . validate_with ( & PostValidationContext { character_limit: 2 } )
1227
1227
. is_err( ) ) ;
1228
1228
}
1229
1229
}
0 commit comments