Skip to content

Add list of follwers on profile page (activitypub side) #2

Description

@guysoft

Hey,
I am planning to add a list of missing features so people can help out. But as an ad-hoc request I am adding this as a task someone can pickup and do that is quite spesific.

Explanation of that is needed

A group should list (in the spec its called OrderedCollection) the members (followers) of the group, for example here is the output of a working group:

The spec for this is here:
https://www.w3.org/TR/activitypub/#followers

curl https://hayu.sh/users/guysoft/following  -H "Accept: application/json"

example output:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://hayu.sh/schemas/litepub-0.1.jsonld",
    {
      "@language": "und"
    }
  ],
  "first": {
    "id": "https://hayu.sh/users/guysoft/following?page=1",
    "next": "https://hayu.sh/users/guysoft/following?page=2",
    "orderedItems": [
      "https://mstdn.social/users/tilvids",
      "https://tooot.im/users/admin",
      "https://indieweb.social/users/commonspub",
      "https://tooot.im/users/talash",
      "https://tooot.im/users/LightBlueScreenOfWindowsUpdate",
      "https://toot.cat/users/rhiaro",
      "https://campaign.openworlds.info/users/boatingeurope",
      "https://octodon.social/users/spritelyproject",
      "https://fosstodon.org/users/uda",
      "https://mastodon.gamedev.place/users/godotengine"
    ],
    "partOf": "https://hayu.sh/users/guysoft/following",
    "totalItems": 250,
    "type": "OrderedCollectionPage"
  },
  "id": "https://hayu.sh/users/guysoft/following",
  "totalItems": 250,
  "type": "OrderedCollection"
}

Note that the list holds orderedItems which lists the users following the group (aka its members)

What exists in fedigroup

In fedigroup this is defined here in the endpoint:

https://github.com/guysoft/fedigroup/blob/main/src/app/main.py#L320

The json is a stub and returns hard-coded only one user:

    "orderedItems": ["https://hayu.sh/users/guysoft"],

https://github.com/guysoft/fedigroup/blob/main/src/app/main.py#LL369C1-L369C55

What is actually needed is to retrieve the the list of members using the database, this can be done using this function:
(get_members_list in crud.py)
https://github.com/guysoft/fedigroup/blob/main/src/app/crud.py#L274

How to improve this

In the log one this actually needs to support pagination. And to return correct partOf and next entries.

Development tips.

If you are having troubble to set up the webserver, you write some cli tool that returns the json and then this can be adapted to be part of the web fastapi later on (but it would be better to have this as a PR where it was tested on the webserver).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions