jointakahe / takahe

An ActivityPub/Fediverse server
BSD 3-Clause "New" or "Revised" License
1.12k stars 86 forks source link

Handle federated followers-only posts, currently treated same as mentioned-only #616

Closed futzle closed 1 year ago

futzle commented 1 year ago

Posted a toot on Mastodon 4.0.x (Hometown, technically) with "Followers" visibility. No users were mentioned in it:

image

It appears in the Takahē database with Visibility = Mentioned (i.e., a "DM").

image

(And it does not appear in the timeline of a user who follows the author, because they weren't mentioned.)

Expected: the post appears in the database with Visibility = Followers.

Takahē 0.9.0 Docker image.

futzle commented 1 year ago

Visibility remains Mentioned after the state changes to fanned_out.

For more fun, if the original poster on Mastodon boosts their followers-only post, it does appear in the Takahē user's timeline, with the client's DM bubble around it: IMG_1908

futzle commented 1 year ago

I tested all the post types that federate: public (works), unlisted (works), mentioned-only (works). Only followers-only posts get miscategorized as "Mentioned". And, reading the code, I cannot figure out why!

Edit: Ohhh, I think it's about here: https://github.com/jointakahe/takahe/blob/1dd076ff7d59da476c2326caa4eefea9d699d744/activities/models/post.py#L920 Looks like incoming federated posts aren't yet checked for the author's Followers collection. And, relatedly, it doesn't look like outbound followers-only posts are tagged accordingly yet: https://github.com/jointakahe/takahe/blob/1dd076ff7d59da476c2326caa4eefea9d699d744/activities/models/post.py#L658

I'm not familiar enough with ActivityPub object representation to know how to patch this, sorry.

andrewgodwin commented 1 year ago

Oh right, I almost forgot I had put this shortcut in a while back - I wasn't seeing a lot of followers-only posts back then so I just decided to make it default to the even more restricted one.

Let me see if I can get a few test messages from my own server and get this working. We still don't fetch follower objects but we can now serve them, at least.

andrewgodwin commented 1 year ago

Alright, fix is into main to make it work both ways - the only thing I noticed is that Mastodon may not respect it as a followers-only post until it refreshes the identity to see that it has followers/following URIs. If you need to force that, just make a tiny edit to your profile and Takahē will ping all follower servers to make them pull it again.