Adding unique ap_ids. Fixes #1100 #90

Merged
dessalines merged 14 commits from unique_ap_ids into activity-sender 2020-08-31 13:46:52 +00:00
Owner
No description provided.
dessalines reviewed 2020-08-25 16:03:22 +00:00
@ -62,3 +62,3 @@
fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
println!("creating {}", &comment_form.ap_id);
// println!("creating {}", &comment_form.ap_id.as_ref().unwrap());
Author
Owner

I had to comment this because it failed for some of the tests, where this ap_id is None.

I had to comment this because it failed for some of the tests, where this `ap_id` is None.
Owner

Just put it into an if Some(ap_id) = form.ap_id?

Just put it into an `if Some(ap_id) = form.ap_id`?
dessalines reviewed 2020-08-25 16:03:50 +00:00
@ -46,3 +46,3 @@
impl CommentForm {
pub fn get_ap_id(&self) -> Result<Url, ParseError> {
Url::parse(&self.ap_id)
Url::parse(&self.ap_id.as_ref().unwrap_or(&"not_a_url".to_string()))
Author
Owner

Seemed easier than doing -> Option<Result<Url...

Seemed easier than doing `-> Option<Result<Url...`
nutomic reviewed 2020-08-26 11:34:06 +00:00
@ -186,1 +186,3 @@
.on_conflict_do_nothing()
.on_conflict(ap_id)
.do_update()
.set(post_form)
Owner

I did it like this on purpose, because otherwise someone could abuse a Create activity to update a post. And under normal circumstances, the old and new post should be identical.

I did it like this on purpose, because otherwise someone could abuse a Create activity to update a post. And under normal circumstances, the old and new post should be identical.
Author
Owner

Hrm... I spose this is the case for comments too. I'll change both, either way they should get real updates through the push, not the fetcher anyway, and the push looks like it correctly uses ::update.

Hrm... I spose this is the case for comments too. I'll change both, either way they should get real updates through the push, not the fetcher anyway, and the push looks like it correctly uses `::update`.
Author
Owner

Okay I finally got these builds working on travis: https://travis-ci.org/github/LemmyNet/lemmy/builds/722512931

Okay I finally got these builds working on travis: https://travis-ci.org/github/LemmyNet/lemmy/builds/722512931
Owner

Great! Tests are also passing fine for me (only tried one run). So this should be good to merge?

Great! Tests are also passing fine for me (only tried one run). So this should be good to merge?
dessalines merged commit 04a367b365 into activity-sender 2020-08-31 13:46:52 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
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: LemmyNet/lemmy#90
No description provided.