MastoAPI can return following AND follow requested relationships at the same time #903

Closed
opened 2019-05-16 01:47:01 +00:00 by nik · 3 comments
Member

On endpoint: https://letsalllovela.in/api/v1/accounts/relationships?id[]=<id>

[
  {
    "blocking": false,
    "domain_blocking": false,
    "endorsed": false,
    "followed_by": false,
    "following": true,
    "id": "9igJNHkszjKbkXxd2m",
    "muting": false,
    "muting_notifications": false,
    "requested": true,
    "showing_reblogs": true,
    "subscribing": false
  }
]

Both requested and following are true at the same time, and despite already following the user, this creates a UI bug which shows the user as follow pending:

image

On endpoint: `https://letsalllovela.in/api/v1/accounts/relationships?id[]=<id>` ``` [ { "blocking": false, "domain_blocking": false, "endorsed": false, "followed_by": false, "following": true, "id": "9igJNHkszjKbkXxd2m", "muting": false, "muting_notifications": false, "requested": true, "showing_reblogs": true, "subscribing": false } ] ``` Both `requested` and `following` are true at the same time, and despite already following the user, this creates a UI bug which shows the user as follow pending: ![image](/attachments/670ec970-320c-4d14-8ebf-cb97d118d00b)
Owner

Thanks to the mastodon documentation providing no description of the data I guess… https://docs.joinmastodon.org/api/entities/#relationship

Thanks to the mastodon documentation providing no description of the data I guess… https://docs.joinmastodon.org/api/entities/#relationship
Owner

Well, I can't reproduce on my instance based on 027ded0df7, I just followed weechat@hostux.social and it worked fine.

[{
	"blocking": false,
	"domain_blocking": false,
	"endorsed": false,
	"followed_by": false,
	"following": true,
	"id": "9itJ6oBHYXTTzoZ6qe",
	"muting": false,
	"muting_notifications": false,
	"requested": false,
	"showing_reblogs": true,
	"subscribing": false
}]
Well, I can't reproduce on my instance based on 027ded0df799266d74d9680bd7ef24450efc910f, I just followed `weechat@hostux.social` and it worked fine. ```json [{ "blocking": false, "domain_blocking": false, "endorsed": false, "followed_by": false, "following": true, "id": "9itJ6oBHYXTTzoZ6qe", "muting": false, "muting_notifications": false, "requested": false, "showing_reblogs": true, "subscribing": false }] ```
Owner

Looking at the code:

  • requested: uses the state of the last follow activity and shows true if it's pending.
  • following: uses User.following? which looks in the following list.

Theses two should be synchronised but I guess some cases can happen where it is buggy so we might want to check for User.following? for requested.

One case where it might happen is an earliest follow request being accepted while the latest one is ignored or failed to federate.

Looking at the code: - `requested`: uses the state of the last follow activity and shows true if it's `pending`. - `following`: uses `User.following?` which looks in the following list. Theses two should be synchronised but I guess some cases can happen where it is buggy so we might want to check for `User.following?` for `requested`. One case where it might happen is an earliest follow request being accepted while the latest one is ignored or failed to federate.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma#903
No description provided.