11# frozen_string_literal: true
22
33class AccountRelationshipsPresenter
4- attr_reader :following , :followed_by , :blocking ,
4+ attr_reader :following , :followed_by , :blocking , :blocked_by ,
55 :muting , :requested , :domain_blocking ,
66 :endorsed
77
@@ -12,6 +12,7 @@ def initialize(account_ids, current_account_id, **options)
1212 @following = cached [ :following ] . merge ( Account . following_map ( @uncached_account_ids , @current_account_id ) )
1313 @followed_by = cached [ :followed_by ] . merge ( Account . followed_by_map ( @uncached_account_ids , @current_account_id ) )
1414 @blocking = cached [ :blocking ] . merge ( Account . blocking_map ( @uncached_account_ids , @current_account_id ) )
15+ @blocked_by = cached [ :blocked_by ] . merge ( Account . blocked_by_map ( @uncached_account_ids , @current_account_id ) )
1516 @muting = cached [ :muting ] . merge ( Account . muting_map ( @uncached_account_ids , @current_account_id ) )
1617 @requested = cached [ :requested ] . merge ( Account . requested_map ( @uncached_account_ids , @current_account_id ) )
1718 @domain_blocking = cached [ :domain_blocking ] . merge ( Account . domain_blocking_map ( @uncached_account_ids , @current_account_id ) )
@@ -22,6 +23,7 @@ def initialize(account_ids, current_account_id, **options)
2223 @following . merge! ( options [ :following_map ] || { } )
2324 @followed_by . merge! ( options [ :followed_by_map ] || { } )
2425 @blocking . merge! ( options [ :blocking_map ] || { } )
26+ @blocked_by . merge! ( options [ :blocked_by_map ] || { } )
2527 @muting . merge! ( options [ :muting_map ] || { } )
2628 @requested . merge! ( options [ :requested_map ] || { } )
2729 @domain_blocking . merge! ( options [ :domain_blocking_map ] || { } )
@@ -37,6 +39,7 @@ def cached
3739 following : { } ,
3840 followed_by : { } ,
3941 blocking : { } ,
42+ blocked_by : { } ,
4043 muting : { } ,
4144 requested : { } ,
4245 domain_blocking : { } ,
@@ -64,6 +67,7 @@ def cache_uncached!
6467 following : { account_id => following [ account_id ] } ,
6568 followed_by : { account_id => followed_by [ account_id ] } ,
6669 blocking : { account_id => blocking [ account_id ] } ,
70+ blocked_by : { account_id => blocked_by [ account_id ] } ,
6771 muting : { account_id => muting [ account_id ] } ,
6872 requested : { account_id => requested [ account_id ] } ,
6973 domain_blocking : { account_id => domain_blocking [ account_id ] } ,
0 commit comments