Fix Following status bug
This commit is contained in:
parent
fb376ce005
commit
4d76692db3
2 changed files with 10 additions and 10 deletions
1
changelog.d/following-state.fix
Normal file
1
changelog.d/following-state.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Resolved edge case where the API can report you are following a user but the relationship is not fully established.
|
|
@ -92,14 +92,13 @@ def render(
|
||||||
User.get_follow_state(reading_user, target)
|
User.get_follow_state(reading_user, target)
|
||||||
end
|
end
|
||||||
|
|
||||||
followed_by =
|
followed_by = FollowingRelationship.following?(target, reading_user)
|
||||||
if following_relationships do
|
following = FollowingRelationship.following?(reading_user, target)
|
||||||
case FollowingRelationship.find(following_relationships, target, reading_user) do
|
|
||||||
%{state: :follow_accept} -> true
|
requested =
|
||||||
_ -> false
|
cond do
|
||||||
end
|
following -> false
|
||||||
else
|
true -> match?(:follow_pending, follow_state)
|
||||||
User.following?(target, reading_user)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
subscribing =
|
subscribing =
|
||||||
|
@ -114,7 +113,7 @@ def render(
|
||||||
# NOTE: adjust UserRelationship.view_relationships_option/2 on new relation-related flags
|
# NOTE: adjust UserRelationship.view_relationships_option/2 on new relation-related flags
|
||||||
%{
|
%{
|
||||||
id: to_string(target.id),
|
id: to_string(target.id),
|
||||||
following: follow_state == :follow_accept,
|
following: following,
|
||||||
followed_by: followed_by,
|
followed_by: followed_by,
|
||||||
blocking:
|
blocking:
|
||||||
UserRelationship.exists?(
|
UserRelationship.exists?(
|
||||||
|
@ -150,7 +149,7 @@ def render(
|
||||||
),
|
),
|
||||||
subscribing: subscribing,
|
subscribing: subscribing,
|
||||||
notifying: subscribing,
|
notifying: subscribing,
|
||||||
requested: follow_state == :follow_pending,
|
requested: requested,
|
||||||
domain_blocking: User.blocks_domain?(reading_user, target),
|
domain_blocking: User.blocks_domain?(reading_user, target),
|
||||||
showing_reblogs:
|
showing_reblogs:
|
||||||
not UserRelationship.exists?(
|
not UserRelationship.exists?(
|
||||||
|
|
Loading…
Reference in a new issue