-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Post creation from Mastodon (fixes #2590) #2651
Conversation
cba2377
to
149391e
Compare
crates/db_schema/src/source/post.rs
Outdated
pub creator_id: PersonId, | ||
#[builder(!default)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be removed, because the database needs them. Would be better to handle the missings in the apub code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
149391e
to
2740feb
Compare
To be honest Im not sure if this is really a good idea. Thats why i made a thread to discuss this. |
There's one other thing I think needs to be added here, from @raphaeljolivet's suggestion: The first link found in the body(if there is one), could be the post link field. |
2740feb
to
c61923c
Compare
I would rather keep it simple, the link isnt that important. Plus it could lead to unexpected behaviour if someone posts a list of multiple links, and only the first one gets emphasized by Lemmy. Btw i cant tell why the api tests are failing, those errors seem completely unrelated. |
5151066
to
371a5a3
Compare
I'll try to run the federation tests locally and see if theres something wrong. |
I also verified that yes this does introduce a bug in the federation tests locally, I'm trying to figure out why. |
@@ -46,7 +46,7 @@ pub struct Page { | |||
pub(crate) attributed_to: AttributedTo, | |||
#[serde(deserialize_with = "deserialize_one_or_many")] | |||
pub(crate) to: Vec<Url>, | |||
pub(crate) name: String, | |||
pub(crate) name: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've confirmed that this line is the one causing the test failures. Changing it back to a required string fixes them.
The error: LemmyError { message: Some("Cant receive page"), inner: Cant receive page, context: "SpanTrace" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats the main change in this PR. If we remove the option, then posts from Mastodon wont work. And that error message doesnt mean anything to me, can you tell where exactly its coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All I could get from the massive output files to /tmp/lemmy_alpha.out
:
2023-01-17T18:07:02.541885Z WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: Cant receive page: Cant receive page 0: lemmy_apub::activities::community::announce::receive at crates/apub/src/activities/community/announce.rs:149
I could post the whole file but I doubt it'd be much help.
Also this one:
cant accept local object from remote instance 0: lemmy_apub::objects::comment::verify at crates/apub/src/objects/comment.rs:135 1: lemmy_apub::activities::create_or_update::comment::verify at crates/apub/src/activities/create_or_update/comment.rs:156 2: lemmy_apub::activities::community::announce::receive at crates/apub/src/activities/community/announce.rs:149
371a5a3
to
92ae390
Compare
Turns out in those failing tests, some comments were parsed as posts which broke things. I managed to create a workaround for this, a deserialize helper function which returns an error if the field |
So what are the "instructions" for doing this? |
@dessalines could you post an example of how we should format posts on mastodon so they can with on Lemmy? interoperability between the fediverse is so amazing! |
You would format it like this:
So for example, I posted this on Mastodon:
and that created this post on Lemmy: https://lemmy.ml/post/8767924 |
@ghobs91 where would the body of the lemmy post go? Is it possible to add a body or images/videos? |
This lets Mastodon users create posts on Lemmy. As they dont send a
name
property, we instead take the beginning of the content.