File tree 3 files changed +15
-9
lines changed
3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,8 @@ impl UserMutation {
145
145
/// Delete a user. The account deleting the user must be an `Admin`.
146
146
async fn delete_user ( & self , gql_ctx : & Context < ' _ > , to_delete_user_id : String ) -> Result < bool > {
147
147
let service = gql_ctx. data_unchecked :: < Arc < UserService > > ( ) ;
148
- service. delete_user ( to_delete_user_id) . await
148
+ let user_id = self . user_id_from_ctx ( gql_ctx) . await ?;
149
+ service. delete_user ( user_id, to_delete_user_id) . await
149
150
}
150
151
151
152
/// Create a new user for the service. Also set their `lot` as admin if
Original file line number Diff line number Diff line change @@ -218,7 +218,10 @@ pub async fn import(input: DeployTraktImportInput) -> Result<ImportResult> {
218
218
show_episode_number,
219
219
..Default :: default ( )
220
220
} ) ;
221
- if let Some ( a) = media. iter_mut ( ) . find ( |i| i. source_id == d. source_id ) {
221
+ if let Some ( a) = media
222
+ . iter_mut ( )
223
+ . find ( |i| i. identifier == d. identifier && i. lot == d. lot )
224
+ {
222
225
a. seen_history . extend ( d. seen_history ) ;
223
226
} else {
224
227
media. push ( d)
@@ -235,9 +238,7 @@ pub async fn import(input: DeployTraktImportInput) -> Result<ImportResult> {
235
238
} )
236
239
}
237
240
238
- fn process_item (
239
- i : & ListItemResponse ,
240
- ) -> std:: result:: Result < ImportOrExportMediaItem , ImportFailedItem > {
241
+ fn process_item ( i : & ListItemResponse ) -> Result < ImportOrExportMediaItem , ImportFailedItem > {
241
242
let ( source_id, identifier, lot) = if let Some ( d) = i. movie . as_ref ( ) {
242
243
( d. ids . trakt , d. ids . tmdb , MediaLot :: Movie )
243
244
} else if let Some ( d) = i. show . as_ref ( ) {
@@ -251,10 +252,10 @@ fn process_item(
251
252
} ) ;
252
253
} ;
253
254
match identifier {
254
- Some ( i ) => Ok ( ImportOrExportMediaItem {
255
+ Some ( identifier ) => Ok ( ImportOrExportMediaItem {
255
256
source_id : source_id. to_string ( ) ,
256
257
lot,
257
- identifier : i . to_string ( ) ,
258
+ identifier : identifier . to_string ( ) ,
258
259
source : MediaSource :: Tmdb ,
259
260
seen_history : vec ! [ ] ,
260
261
reviews : vec ! [ ] ,
Original file line number Diff line number Diff line change @@ -245,8 +245,12 @@ impl UserService {
245
245
Ok ( users)
246
246
}
247
247
248
- pub async fn delete_user ( & self , to_delete_user_id : String ) -> Result < bool > {
249
- admin_account_guard ( & self . db , & to_delete_user_id) . await ?;
248
+ pub async fn delete_user (
249
+ & self ,
250
+ admin_user_id : String ,
251
+ to_delete_user_id : String ,
252
+ ) -> Result < bool > {
253
+ admin_account_guard ( & self . db , & admin_user_id) . await ?;
250
254
let maybe_user = User :: find_by_id ( to_delete_user_id) . one ( & self . db ) . await ?;
251
255
if let Some ( u) = maybe_user {
252
256
if self
You can’t perform that action at this time.
0 commit comments