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

[API] Create endpoint to confirm a pending follower request #7887

Closed
MrPetovan opened this issue Dec 1, 2019 · 32 comments
Closed

[API] Create endpoint to confirm a pending follower request #7887

MrPetovan opened this issue Dec 1, 2019 · 32 comments
Assignees
Milestone

Comments

@MrPetovan
Copy link
Collaborator

Part of #6739

What about Mastodon's API endpoints:

cc @stom79

@ghost
Copy link

ghost commented Dec 1, 2019

That would be perfect 👍

@MrPetovan
Copy link
Collaborator Author

Curious question, how do you decide which endpoint to use in Fedilab? Is there a matrix by target software? I'm surprised you welcome combining a Twitter endpoint to a couple of Mastodon's endpoint to interact with Friendica.

@ghost
Copy link

ghost commented Dec 1, 2019

In fact, I am not really choosing which endpoints to use because I want to use them all :)
For pointing what endpoints I would like to see with Friendica, it's first for implementing most appreciated features.
The app allows to follow other instances, it's only a public api call. But as soon as a user interacts, the app needs to have the ability to federate this message and the attached account to the instance. That's why I am deeply interested to the search feature.
Also, this is how the app works for cross-account actions. With that feature, people having an account on Mastodon and Friendica can boost, fav, reply, follow with the other account without switching.
And yes, Friendica has its dedicated management inside the app, so I can add specific features or layouts :)
But the Friendica community using Fedilab tells me also what they would like to have.

@annando
Copy link
Collaborator

annando commented Dec 2, 2019

@stom79 BTW: where can I place some feature requests? Currently quoted posts aren't displayed well.

@MrPetovan
Copy link
Collaborator Author

I started working on this instead of the custom profile fields feature.

@MrPetovan MrPetovan self-assigned this Dec 2, 2019
@ghost
Copy link

ghost commented Dec 2, 2019

@stom79 BTW: where can I place some feature requests? Currently quoted posts aren't displayed well.

Could you provide me examples so I can compare with the web app and work on that issue. Otherwise, issues for Fedilab are here: https://framagit.org/tom79/fedilab/issues

@annando
Copy link
Collaborator

annando commented Dec 2, 2019

The quotes are described here: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#quotetweet

Additionally to the regular text they have got some quoted_status field. And it looks like this: https://twitter.com/hbhammel/status/1201553619440545793

The quoted_status contains everything that the original post has got as well, including attachments.

@ghost
Copy link

ghost commented Dec 2, 2019

OK. I will work on it: https://framagit.org/tom79/fedilab/issues/367

@ghost
Copy link

ghost commented Dec 3, 2019

Also, could we agree to use the same URL for endpoints that will come with the Mastodon API? I mean they will start by /api/(v1|v2)/same_endpoint_name (and parameters)?

That will really help in future when some endpoints will be migrated to the Mastodon API. On my end, it's really not a problem to mix api for a same software (I already do it for Pixelfed).
Currently, I am working with the Twitter api for implementing some missing endpoints for Friendica.

@annando
Copy link
Collaborator

annando commented Dec 3, 2019

I would prefer implementing new API calls with Mastodon-like endpoints. But I'm unsure if we will have it done for the current release that is planned for the end of the year. We currently do have some ugly behaviour with reshares that are having priority.

@MrPetovan
Copy link
Collaborator Author

MrPetovan commented Dec 3, 2019

Also, could we agree to use the same URL for endpoints that will come with the Mastodon API? I mean they will start by /api/(v1|v2)/same_endpoint_name (and parameters)?

Yes, that's what we meant when we say we implement Mastodon/Twitter's API endpoint. We use the same URL, same parameters and same return values.

@ghost
Copy link

ghost commented Dec 3, 2019

The quotes are described here: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#quotetweet

Additionally to the regular text they have got some quoted_status field. And it looks like this: https://twitter.com/hbhammel/status/1201553619440545793

The quoted_status contains everything that the original post has got as well, including attachments.

OK. I checked and I would need to have them attached to the status object. I can't do special calls for each cardview that would be too costly. The html content will not help for apps as they don't run webview.

Also, I noticed that the api returns some empty links like, I guess for a media gallery?
<a href="https://libranet.de/photos/USERNAME/image/17410654725de40af16e4f2179729508"></a>
But it can't be used directly.

@annando
Copy link
Collaborator

annando commented Dec 3, 2019

The "quoted_status" is attached to the original "status" object and contains the whole stuff (the HTML, the user array and so on). There is no need for refetching anything. Isn't it possible to "simply" attach it with some <blockquote>...</blockquote> surrounding it?

@ghost
Copy link

ghost commented Dec 3, 2019

Not so simple to mix (transform html) ie via friendica_html
I tried but now reblogs (shares) are affected and are ugly (lot of spaces). That would need more logic. I think that the best would be to use a card like Mastodon https://docs.joinmastodon.org/api/entities/#card

@MrPetovan
Copy link
Collaborator Author

Can you please move over this discussion to Fedilab's issue tracker?

@MrPetovan
Copy link
Collaborator Author

First part is done, now I need to provide the endpoint to accept/reject a follow request. This should be faster as I won’t have to rewrite the entire API documentation again 😅

@annando
Copy link
Collaborator

annando commented Dec 10, 2019

You have to ensure to not confirm requests from native DFRN. Only AP, Diaspora and DFRN via AP can be confirmed via API.

@MrPetovan
Copy link
Collaborator Author

Thanks for the tip. Should I exclude DFRN contact follow requests from the GET endpoint list?

@annando
Copy link
Collaborator

annando commented Dec 10, 2019

It's slightly more complicated than simply DFRN contacts. Have a look at the "protocol" field as well. When this is filled (with AP), then it can be confirmed as well.

@MrPetovan
Copy link
Collaborator Author

Ok thanks.

@annando
Copy link
Collaborator

annando commented Dec 10, 2019

Do you know the function to accept requests or should I help searching for it?

BTW: If you want to add some endpoint to follow someone as well, have a look at Contact::createFromProbe.

@MrPetovan
Copy link
Collaborator Author

No, I'm going to limit myself to the task at hand. I was planning on following the web modules.

@MrPetovan
Copy link
Collaborator Author

With #7930 this issue should now be complete. @stom79 can you please confirm the endpoints are working as expected on libranet.de?

@AlfredSK
Copy link

Wait. I haven't pulled that one yet. 😁

@MrPetovan
Copy link
Collaborator Author

I was assuming that by the time @stom79 would have read my message and found time to test, you would already have.

@AlfredSK
Copy link

Now I'm ready.

@MrPetovan
Copy link
Collaborator Author

Any news @stom79 ?

@ghost
Copy link

ghost commented Dec 21, 2019

Currently, the POST call to https://libranet.de/api/v1/follow_requests/%s/authorize (%s string id for an account), returns:

<html>
    	<head>
    		<title>Not found</title>
    	</head>
    	<body>
    		<h1>Not found</h1>
    		<p></p>
    	</body>
    </html>

Could it be related to an error with the id %s?

@ghost
Copy link

ghost commented Dec 21, 2019

OK. Please ignore my previous message. I was not using the new endpoint for getting follow requests and user ids were different.
It perfectly works when fetching pending follow requests with the new endpoint + post authorize.

@annando
Copy link
Collaborator

annando commented Dec 21, 2019

@MrPetovan possibly we should always publish the public contact id? I guess this avoids some confusion.

@MrPetovan
Copy link
Collaborator Author

@MrPetovan possibly we should always publish the public contact id? I guess this avoids some confusion.

I don't think so, the endpoint is follow_requests so it returns a follow request ID.

@tobiasd tobiasd modified the milestones: 2019.12, 2020.03 Dec 23, 2019
@MrPetovan
Copy link
Collaborator Author

Closed by #7930

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

No branches or pull requests

4 participants