Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
guysoft opened this issue May 28, 2023 · 1 comment
Open

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

guysoft opened this issue May 28, 2023 · 1 comment

Comments

@guysoft
Copy link
Owner

guysoft commented May 28, 2023

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).

@guysoft
Copy link
Owner Author

guysoft commented May 31, 2023

I seem to have implemented this, but without pagination, which would really be the next step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant