-
Notifications
You must be signed in to change notification settings - Fork 7
fix: ingest unknown users #795
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| mod bookmarks; | ||
| mod files; | ||
| mod follows; | ||
| mod homeserver; | ||
| mod mentions; | ||
| mod network; | ||
| mod posts; | ||
|
|
||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mod active_homeservers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| mod event_processor; | ||
| mod homeserver; | ||
| mod service; | ||
| mod user_ingestion; |
22 changes: 5 additions & 17 deletions
22
.../ingest_homeservers_from_follow_events.rs → ...gestion/ingest_user_from_follow_events.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,34 @@ | ||
| use crate::event_processor::{ | ||
| homeserver::utils::create_external_test_homeserver, utils::watcher::WatcherTest, | ||
| }; | ||
| use super::utils::{assert_user_ingested, create_external_test_homeserver}; | ||
| use crate::event_processor::utils::watcher::WatcherTest; | ||
| use anyhow::Result; | ||
| use nexus_common::models::homeserver::Homeserver; | ||
| use pubky::Keypair; | ||
| use pubky_app_specs::{PubkyAppUser, PubkyId}; | ||
| use pubky_app_specs::PubkyAppUser; | ||
|
|
||
| #[tokio_shared_rt::test(shared)] | ||
| async fn test_follow_on_unknown_homeserver() -> Result<()> { | ||
| let mut test = WatcherTest::setup().await?; | ||
|
|
||
| // Create a separate homeserver for the followee | ||
| let followee_hs_pk = create_external_test_homeserver(&mut test).await?; | ||
| let followee_hs_id = PubkyId::try_from(&followee_hs_pk.to_z32()).unwrap(); | ||
|
|
||
| // Create followee | ||
| let followee_kp = Keypair::random(); | ||
| let followee_id = followee_kp.public_key().to_z32(); | ||
|
|
||
| // Register the followee PK in the new homeserver | ||
| // We only need the record mapping, not necessarily the profile.json being uploaded | ||
| test.register_user_in_hs(&followee_kp, &followee_hs_pk) | ||
| .await?; | ||
|
|
||
| // Create follower user | ||
| let follower_kp = Keypair::random(); | ||
| let follower_user = PubkyAppUser { | ||
| bio: Some("test_follow_on_unknown_homeserver".to_string()), | ||
| image: None, | ||
| links: None, | ||
| name: "Watcher:Homeserver:Follow".to_string(), | ||
| name: "Watcher:UserIngestion:Follow".to_string(), | ||
| status: None, | ||
| }; | ||
| let _follower_id = test.create_user(&follower_kp, &follower_user).await?; | ||
|
|
||
| // Follow the followee | ||
| test.create_follow(&follower_kp, &followee_id).await?; | ||
|
|
||
| assert!(Homeserver::get_by_id(followee_hs_id) | ||
| .await | ||
| .unwrap() | ||
| .is_some()); | ||
| assert_user_ingested(&followee_id, &followee_hs_pk).await; | ||
|
|
||
| Ok(()) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.