Migrate user/group to new activitystreams library #66

Manually merged
dessalines merged 1 commits from migrate-apub-lib into master 2020-07-08 16:17:08 +00:00
Owner

I'm not a fan of the take* methods. It might be good for performance, but makes the code more complicated imo.

Also I'm not sure how to use the methods in ApActorExt, like let mut person = Person::new(); person.set_endpoints(). I always get the following error, do I need a different kind of object for that?

error[E0599]: no method named `set_endpoints` found for struct `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>` in the current scope
--> src/apub/user.rs:62:8
|
62  |       .set_endpoints(endpoint_props)?;
|        ^^^^^^^^^^^^^ method not found in `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>`
|
::: /home/felix/.cargo/git/checkouts/activitystreams-sketch-b29e0c9dc9b9ce7d/99c7e9a/src/actor.rs:846:1
|
846 | pub struct Actor<Kind>(pub Object<Kind>);
| -----------------------------------------
| |
| doesn't satisfy `_: activitystreams_new::actor::ApActorExt<_>`
| doesn't satisfy `_: activitystreams_new::actor::AsApActor<_>`
|
= note: the method `set_endpoints` exists but the following trait bounds were not satisfied:
`activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>: activitystreams_new::actor::AsApActor<_>`
which is required by `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>: activitystreams_new::actor::ApActorExt<_>`
I'm not a fan of the `take*` methods. It might be good for performance, but makes the code more complicated imo. Also I'm not sure how to use the methods in `ApActorExt`, like `let mut person = Person::new(); person.set_endpoints()`. I always get the following error, do I need a different kind of object for that? ``` error[E0599]: no method named `set_endpoints` found for struct `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>` in the current scope --> src/apub/user.rs:62:8 | 62 | .set_endpoints(endpoint_props)?; | ^^^^^^^^^^^^^ method not found in `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>` | ::: /home/felix/.cargo/git/checkouts/activitystreams-sketch-b29e0c9dc9b9ce7d/99c7e9a/src/actor.rs:846:1 | 846 | pub struct Actor<Kind>(pub Object<Kind>); | ----------------------------------------- | | | doesn't satisfy `_: activitystreams_new::actor::ApActorExt<_>` | doesn't satisfy `_: activitystreams_new::actor::AsApActor<_>` | = note: the method `set_endpoints` exists but the following trait bounds were not satisfied: `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>: activitystreams_new::actor::AsApActor<_>` which is required by `activitystreams_new::actor::Actor<activitystreams::actor::kind::PersonType>: activitystreams_new::actor::ApActorExt<_>` ```
Author
Owner

Second commit might have broken the federation test, its just stuck at Waiting for Lemmy to start....

Second commit might have broken the federation test, its just stuck at `Waiting for Lemmy to start...`.
nutomic changed title from Migrate user to new activitystreams library to Migrate user/group to new activitystreams library 2020-07-03 15:37:04 +00:00
nutomic reviewed 2020-07-06 17:56:24 +00:00
@ -378,0 +373,4 @@
pool: &DbPool,
) -> Result<Self, LemmyError> {
// TODO: this is probably gonna cause problems cause fetcher:292 also calls take_attributed_to()
let creator_and_moderator_uris = group.take_attributed_to().unwrap();
Author
Owner

This here seems problematic, because attributed_to is taken in two places.

This here seems problematic, because `attributed_to` is taken in two places.
Owner

You called it. The fix was easier than expected, just call a clone:

let creator_and_moderator_uris = group.clone().take_attributed_to().unwrap();

The tests are passing now.

You called it. The fix was easier than expected, just call a clone: `let creator_and_moderator_uris = group.clone().take_attributed_to().unwrap();` The tests are passing now.
Author
Owner

Thanks! But I feel like this almost makes the take_* methods pointless, the performance that they give is probably all lost here.

Thanks! But I feel like this almost makes the `take_*` methods pointless, the performance that they give is probably all lost here.
Author
Owner

Btw I remembered that I forgot to remove the TODO here.

Btw I remembered that I forgot to remove the TODO here.
Owner

Hrm I'm getting this error when testing:

lemmy-beta_1      | [2020-07-08T14:46:25Z DEBUG lemmy_server::apub] Checking http://lemmy-alpha:8540/u/lemmy_alpha
lemmy-alpha_1     | [2020-07-08T14:46:25Z INFO  actix_web::middleware::logger] 172.23.0.8:48828 "GET /u/lemmy_alpha HTTP/1.1" 200 112
3 "-" "-" 0.007529
lemmy-beta_1      | thread 'actix-rt:worker:2' panicked at 'called `Option::unwrap()` on a `None` value', src/apub/fetcher.rs:292:60

I'll investigate.

Hrm I'm getting this error when testing: ``` lemmy-beta_1 | [2020-07-08T14:46:25Z DEBUG lemmy_server::apub] Checking http://lemmy-alpha:8540/u/lemmy_alpha lemmy-alpha_1 | [2020-07-08T14:46:25Z INFO actix_web::middleware::logger] 172.23.0.8:48828 "GET /u/lemmy_alpha HTTP/1.1" 200 112 3 "-" "-" 0.007529 lemmy-beta_1 | thread 'actix-rt:worker:2' panicked at 'called `Option::unwrap()` on a `None` value', src/apub/fetcher.rs:292:60 ``` I'll investigate.
Owner

That one clone was the only one necessary, and the tests are passing. When you add that, I'll merge.

That one clone was the only one necessary, and the tests are passing. When you add that, I'll merge.
dessalines manually merged commit d720993141 into master 2020-07-08 16:17:08 +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#66
No description provided.