Follower migration left some follow relationships in 'pending'
Apparently, some relationships where not properly migrated and had formerly-followed relationships in a 'pending' state. @feld reported that his site was hit extremely by this, having nearly all relationships in this state, but I found some that seem to fit the bill in soykaf, too. I know that @rinpatch noticed some follower issues on his instance as well.
Here's a way to find relationships that are pending, but the user being followed isn't locked and also has not blocked the follower:
SELECT
COUNT (*)
FROM
following_relationships
,users AS following
,users AS follower
WHERE
following.id = following_id
AND follower.id = follower_id
AND following.locked = FALSE
AND (
NOT (
follower.ap_id = ANY (following.blocks)
)
)
AND state = 'pending'
;
these relationships can be set to an accepted state with this:
UPDATE
following_relationships
SET
state = 'accept'
FROM
users AS following
,users AS follower
WHERE
following.id = following_id
AND follower.id = follower_id
AND following.locked = FALSE
AND (
NOT (
follower.ap_id = ANY (following.blocks)
)
)
AND state = 'pending'
;
This will 'fix' these relationships, but we have to figure out the error in @egor 's original migration and modify it to work correctly.
Other oddities:
-
User.follow
never seems to update thefollowing_count
for local users. Why? User.user_info uses this field when present. -
User.follow_all
seems to superfluously call toupdate_follower_count
, which is already called infollow
.