akirk / enable-mastodon-apps

Allow accessing your WordPress blog with Mastodon clients
https://wordpress.org/plugins/enable-mastodon-apps
GNU General Public License v2.0
36 stars 6 forks source link

Following: posts and boosts from accounts I follow do not appear in third-party app's main request #168

Open jeherve opened 3 months ago

jeherve commented 3 months ago

When I installed this plugin, alongside Friends and ActivityPub, I expected posts from Fediverse accounts I follow (either by entering their handle in Friends' wp-admin settings or by hitting Follow in a third-party app) to appear in my timeline in third-party apps.

However, the api/v1/timelines/home endpoint the third-party application (Semaphore, for example) seems to call does not return posts from folks I follow. It returns activity from my site.

I do see posts from people I follow in the /friends/ page on my site, though.

How could I debug this further?

jeherve commented 3 months ago

does not return posts from folks I follow. It returns activity from my site.

Looking into this further, here is an example of an item returned by the endpoint:

First item returned in the JSON response ```json { "id": "736", "created_at": "2024-08-13T06:26:20.000Z", "spoiler_text": "", "visibility": "public", "uri": "https://herve.bzh/?enable-mastodon-apps=reblog-of-731", "content": "Reblog of 731", "url": null, "language": null, "in_reply_to_id": null, "in_reply_to_account_id": null, "text": null, "edited_at": null, "sensitive": false, "favourited": false, "reblogged": false, "muted": false, "bookmarked": false, "pinned": false, "filtered": [], "media_attachments": [], "mentions": [], "tags": [], "emojis": [], "replies_count": 0, "reblogs_count": 0, "favourites_count": 0, "card": null, "poll": null, "account": { "id": "0", "username": "", "acct": "jeremy", "url": "https://herve.bzh/friends//", "display_name": "", "note": "

WordPress, TV Series, music, kids, and board games. I think that's probably the best way to define me in a few words. πŸ™‚

\n

I work at Automattic on the Jetpack plugin and its infrastructure. You'll consequently find me talking about WordPress things a lot, but also about all things open source in general.

\n

I am French and live in Brittany, so I will post in French from time to time, as well as share pictures of our beautiful Brittany. πŸ™‚

\n", "avatar": "", "avatar_static": "", "header": "", "header_static": "", "locked": false, "bot": false, "group": false, "discoverable": true, "noindex": false, "suspended": false, "limited": false, "statuses_count": 101, "followers_count": 20, "following_count": 0, "source": { "privacy": "public", "sensitive": false, "language": "fr_FR", "note": "", "fields": [] }, "fields": [ { "name": "Blog", "value": "

herve.bzh

" }, { "name": "Profil", "value": "

herve.bzh

" }, { "name": "Homepage", "value": "

jeremy.hu

" }, { "name": "My other Fediverse account", "value": "

@jeremy@fedi.jeremy.hu

" } ], "emojis": [], "created_at": "2024-08-13T08:56:37.000Z", "last_status_at": "2024-08-13" }, "reblog": null }, ```

At first, I thought this was a boost of one of my posts. However, I was wrong. When I click on that first item, I see this in my client:

image

However, in parallel the client does a request to https://herve.bzh/api/v1/statuses/736 to fetch that specific item, and it returns the following:

{
  "id": "736",
  "created_at": "2024-08-13T06:26:20.000Z",
  "spoiler_text": "",
  "visibility": "public",
  "uri": "https://hci.social/@juliagersey/112951946184373958",
  "content": "<p>Switching over from Twitter today…\u2029πŸ‘‹πŸ» I’m Julia, an incoming ECE PhD student at the University of Michigan. My research focuses on using embedded sensing systems to help communities &amp; the environment. 2 weeks til classes start! <br />\u2029<a href=\"https://hci.social/tags/academia\" class=\"mention hashtag\" rel=\"tag\">#<span>academia</span></a> <a href=\"https://hci.social/tags/phd\" class=\"mention hashtag\" rel=\"tag\">#<span>phd</span></a></p>",
  "url": null,
  "language": null,
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "text": null,
  "edited_at": null,
  "sensitive": false,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "filtered": [],
  "media_attachments": [],
  "mentions": [],
  "tags": [],
  "emojis": [],
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "card": null,
  "poll": null,
  "account": {
    "id": "10000000202",
    "username": "juliagersey",
    "acct": "jeremy",
    "url": "https://hci.social/users/juliagersey",
    "display_name": "juliagersey",
    "note": "<p>WordPress, TV Series, music, kids, and board games. I think that's probably the best way to define me in a few words. πŸ™‚</p>\n<p>I work at Automattic on the Jetpack plugin and its infrastructure. You'll consequently find me talking about WordPress things a lot, but also about all things open source in general.</p>\n<p>I am French and live in Brittany, so I will post in French from time to time, as well as share pictures of our beautiful Brittany. πŸ™‚</p>\n",
    "avatar": "https://storage.googleapis.com/hci-social-storage/accounts/avatars/112/951/262/199/494/207/original/9e93d8976bccd7fc.png",
    "avatar_static": "https://storage.googleapis.com/hci-social-storage/accounts/avatars/112/951/262/199/494/207/original/9e93d8976bccd7fc.png",
    "header": "https://files.mastodon.social/media_attachments/files/003/134/405/original/04060b07ddf7bb0b.png",
    "header_static": "https://files.mastodon.social/media_attachments/files/003/134/405/original/04060b07ddf7bb0b.png",
    "locked": false,
    "bot": false,
    "group": false,
    "discoverable": true,
    "noindex": false,
    "suspended": false,
    "limited": false,
    "statuses_count": 28,
    "followers_count": 20,
    "following_count": 0,
    "source": {
      "privacy": "public",
      "sensitive": false,
      "language": "fr_FR",
      "note": "<p>CTO, founder of <span class=\"h-card\" translate=\"no\"><a href=\"https://mementomori.social/@dude\" class=\"u-url mention\">@<span>dude</span></a></span>, admin of many servers like this one. Web developer, CSS wizard, *nix user, an advocate for open and ethical Internet. Creator of the Mastodon Bird UI. I do WordPress and open source for a living.</p>",
      "fields": []
    },
    "fields": [
      {
        "name": "Blog",
        "value": "<p><a rel=\"me noopener\" title=\"https://herve.bzh/\" target=\"_blank\" href=\"https://herve.bzh/\">herve.bzh</a></p>"
      },
      {
        "name": "Profil",
        "value": "<p><a rel=\"me noopener\" title=\"https://herve.bzh/author/jeremy/\" target=\"_blank\" href=\"https://herve.bzh/author/jeremy/\">herve.bzh</a></p>"
      },
      {
        "name": "Homepage",
        "value": "<p><a rel=\"me noopener\" title=\"https://jeremy.hu/\" target=\"_blank\" href=\"https://jeremy.hu/\">jeremy.hu</a></p>"
      },
      {
        "name": "My other Fediverse account",
        "value": "<p><a href=\"https://fedi.jeremy.hu/@jeremy\">@jeremy@fedi.jeremy.hu</a></p><p></p>"
      }
    ],
    "emojis": [],
    "created_at": "2024-08-12T15:44:26.000Z",
    "last_status_at": "2024-08-13"
  },
  "reblog": null
}

The content is more interesting here ; I get the actual content of the post. It appears to be a post from someone I do not follow, but I see that that post was boosted by someone I follow ; this is how it got into my timeline.

When I hit return in my client, the post content has been replaced from Reblog of 731 to the correct information:

image

If I keep clicking on each "Reblog of" item, each post appears.

akirk commented 3 months ago

Thanks for the debugging, I think you made some important findings there. The home timeline and the status should go through the same filters, I think I haven't tested the case for your own reblogs yet. So would you say the original issue remains like you put it or is the issue most about your own reblog?

jeherve commented 3 months ago

I think I haven't tested the case for your own reblogs yet.

To clarify, these are not my own reblogs. They're posts that people I follow have boosted.

So would you say the original issue remains like you put it or is the issue most about your own reblog?

I adjusted the title a bit, hopefully to make that clearer.

pfefferle commented 3 months ago

I am not sure if the Friends plugin supports boosts and likes, but ActivityPub does not (yet). We are currently implementing it behind a feature flag.

akirk commented 2 months ago

Ok, I think I understand this better now. For the statuses/id endpoint, it does an ActivityPub request to the remote server, for the home timeline it doesn't but it would be too costly to do this for each item in the timeline. So I suppose the best way to solve this is in the Friends plugin to fetch this additional information already when the Reblog is received.