@@ -262,8 +262,10 @@ impl Index {
262262 ///
263263 /// This function will return an error if unable to get the torrent from the
264264 /// database.
265- pub async fn get_torrent ( & self , info_hash : & InfoHash , opt_user_id : Option < UserId > ) -> Result < Torrent , ServiceError > {
266- self . authorization_service . authorize ( ACTION :: GetTorrent , opt_user_id) . await ?;
265+ pub async fn get_torrent ( & self , info_hash : & InfoHash , maybe_user_id : Option < UserId > ) -> Result < Torrent , ServiceError > {
266+ self . authorization_service
267+ . authorize ( ACTION :: GetTorrent , maybe_user_id)
268+ . await ?;
267269
268270 let mut torrent = self . torrent_repository . get_by_info_hash ( info_hash) . await ?;
269271
@@ -275,7 +277,7 @@ impl Index {
275277
276278 if !tracker_is_private {
277279 torrent. include_url_as_main_tracker ( & tracker_url) ;
278- } else if let Some ( authenticated_user_id) = opt_user_id {
280+ } else if let Some ( authenticated_user_id) = maybe_user_id {
279281 let personal_announce_url = self . tracker_service . get_personal_announce_url ( authenticated_user_id) . await ?;
280282 torrent. include_url_as_main_tracker ( & personal_announce_url) ;
281283 } else {
@@ -331,16 +333,16 @@ impl Index {
331333 pub async fn get_torrent_info (
332334 & self ,
333335 info_hash : & InfoHash ,
334- opt_user_id : Option < UserId > ,
336+ maybe_user_id : Option < UserId > ,
335337 ) -> Result < TorrentResponse , ServiceError > {
336338 self . authorization_service
337- . authorize ( ACTION :: GetTorrentInfo , opt_user_id )
339+ . authorize ( ACTION :: GetTorrentInfo , maybe_user_id )
338340 . await ?;
339341
340342 let torrent_listing = self . torrent_listing_generator . one_torrent_by_info_hash ( info_hash) . await ?;
341343
342344 let torrent_response = self
343- . build_full_torrent_response ( torrent_listing, info_hash, opt_user_id )
345+ . build_full_torrent_response ( torrent_listing, info_hash, maybe_user_id )
344346 . await ?;
345347
346348 Ok ( torrent_response)
@@ -354,10 +356,10 @@ impl Index {
354356 pub async fn generate_torrent_info_listing (
355357 & self ,
356358 request : & ListingRequest ,
357- opt_user_id : Option < UserId > ,
359+ maybe_user_id : Option < UserId > ,
358360 ) -> Result < TorrentsResponse , ServiceError > {
359361 self . authorization_service
360- . authorize ( ACTION :: GenerateTorrentInfoListing , opt_user_id )
362+ . authorize ( ACTION :: GenerateTorrentInfoListing , maybe_user_id )
361363 . await ?;
362364
363365 let torrent_listing_specification = self . listing_specification_from_user_request ( request) . await ;
@@ -484,7 +486,7 @@ impl Index {
484486 & self ,
485487 torrent_listing : TorrentListing ,
486488 info_hash : & InfoHash ,
487- opt_user_id : Option < UserId > ,
489+ maybe_user_id : Option < UserId > ,
488490 ) -> Result < TorrentResponse , ServiceError > {
489491 let torrent_id: i64 = torrent_listing. torrent_id ;
490492
@@ -515,7 +517,7 @@ impl Index {
515517
516518 if self . tracker_is_private ( ) . await {
517519 // Add main tracker URL
518- match opt_user_id {
520+ match maybe_user_id {
519521 Some ( user_id) => {
520522 let personal_announce_url = self . tracker_service . get_personal_announce_url ( user_id) . await ?;
521523
@@ -568,10 +570,10 @@ impl Index {
568570 pub async fn get_canonical_info_hash (
569571 & self ,
570572 info_hash : & InfoHash ,
571- opt_user_id : Option < UserId > ,
573+ maybe_user_id : Option < UserId > ,
572574 ) -> Result < Option < InfoHash > , ServiceError > {
573575 self . authorization_service
574- . authorize ( ACTION :: GetCanonicalInfoHash , opt_user_id )
576+ . authorize ( ACTION :: GetCanonicalInfoHash , maybe_user_id )
575577 . await ?;
576578
577579 self . torrent_info_hash_repository
0 commit comments