-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor(apub): move service to user #39
Conversation
WalkthroughThe recent updates focus on renaming and restructuring entities related to the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- crates/api_apub/src/users/user.rs (4 hunks)
- crates/api_mastodon/src/entities/account.rs (3 hunks)
- crates/api_mastodon/src/entities/status.rs (2 hunks)
- crates/apub/src/actors/db_user.rs (5 hunks)
- crates/apub/src/actors/mod.rs (1 hunks)
- crates/apub/src/actors/user.rs (1 hunks)
- crates/apub/src/actors/user_attachment.rs (1 hunks)
- crates/apub/src/actors/user_image.rs (1 hunks)
- crates/apub/tests/actors.rs (1 hunks)
- crates/openapi/src/apidoc.rs (1 hunks)
Additional comments not posted (13)
crates/apub/tests/actors.rs (1)
1-6
: The test function correctly uses the updatedUser
entity.crates/apub/src/actors/mod.rs (1)
3-10
: The module declarations and public exports are correctly updated to reflect the newUser
entity structure.crates/apub/src/actors/user_image.rs (1)
1-25
: TheUserImage
struct is correctly defined with appropriate serialization settings and schema annotations.crates/api_mastodon/src/entities/status.rs (1)
Line range hint
35-44
: TheStatus
struct and thefrom_json
method are correctly updated to use theUser
entity.crates/apub/src/actors/user_attachment.rs (1)
1-51
: TheUserAttachment
struct and its methods are correctly defined with appropriate serialization settings and schema annotations.crates/api_mastodon/src/entities/account.rs (1)
Line range hint
25-51
: TheAccount
struct and its methods are correctly updated to use theUser
entity.crates/api_apub/src/users/user.rs (1)
Line range hint
10-81
: Theuser
function is correctly updated to use theUser
entity.crates/apub/src/actors/user.rs (1)
1-86
: TheUser
struct and theUserType
enum are correctly defined with appropriate serialization settings and schema annotations.crates/openapi/src/apidoc.rs (1)
41-43
: The updates to the OpenAPI schema components align well with the renaming strategy outlined in the PR. Ensure that these changes are consistently applied across all related files.Verification successful
The renaming from
Service
toUser
has been consistently applied across the codebase. The remaining occurrences ofService
andServiceType
are legitimate uses in different contexts, such asActivityPub
andNodeInfoServices
.
crates/apub/src/actors/user.rs
:ServiceType
andService
are used in the context ofActivityPub
.crates/apub/src/actors/db_user.rs
:ServiceType
andService
are used in the context ofActivityPub
.crates/nodeinfo/src/schema.rs
:NodeInfoServices
is a distinct concept.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the renaming from `Service` to `User` is consistently applied across all related files. # Test: Search for the old `Service` naming in the project. Expect: No occurrences of `Service` related to the renamed entities. rg --type rust --glob '!migrations/*' 'Service'Length of output: 907
Script:
#!/bin/bash # Description: Examine the context of occurrences of `Service` to determine if they are related to the renaming from `Service` to `User`. # Display lines around the matches in `crates/apub/src/actors/user.rs` and `crates/apub/src/actors/db_user.rs` to understand the context. rg --type rust --glob '!migrations/*' -C 3 'Service' crates/apub/src/actors/user.rs crates/apub/src/actors/db_user.rsLength of output: 2589
Script:
#!/bin/bash # Description: Verify if `ServiceType` and `Service` are intended to remain as is or if they should be renamed. # Search for the definition and usages of `ServiceType` and `Service` in the codebase. rg --type rust --glob '!migrations/*' 'ServiceType' rg --type rust --glob '!migrations/*' 'Service'Length of output: 1258
crates/apub/src/actors/db_user.rs (4)
11-11
: The renaming of the import toPreludeUser
is a good strategy to avoid naming conflicts with theUser
entity defined in this crate.
47-47
: The updates to theObject
trait implementation forApubUser
are correctly using the newUser
entity names and thePreludeUser
for database interactions.Also applies to: 57-57, 64-64
100-100
: The use of theon_conflict
clause in theinsert
method is a prudent choice to handle potential primary key conflicts safely.
123-123
: The use ofUserType::ServiceType(ServiceType::Service)
seems inconsistent with the renaming strategy. Please verify if this is intended or if it should be updated to reflect the new terminology.Verification successful
The definitions of the
UserType
andServiceType
enums confirm that the usage ofUserType::ServiceType(ServiceType::Service)
is consistent with the current terminology in the codebase. TheUserType
enum includes a variantServiceType
that takes aServiceType
enum as its parameter, andServiceType
is used correctly in this context.
UserType
enum includes:
ServiceType(ServiceType)
PersonType(PersonType)
ServiceType
is used as expected within theUserType
enum.Therefore, the usage of
UserType::ServiceType(ServiceType::Service)
is correct and consistent with the defined enums.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `UserType::ServiceType` in the context of the renaming strategy. # Test: Search for the usage of `UserType::ServiceType`. Expect: Consistent usage or updates to match the new terminology. rg --type rust 'UserType::ServiceType'Length of output: 135
Script:
#!/bin/bash # Description: Find the definition of `UserType` enum and its variants. # Search for the definition of `UserType` enum. ast-grep --lang rust --pattern 'enum UserType { $$$ }' # Search for the definition of `ServiceType` enum. ast-grep --lang rust --pattern 'enum ServiceType { $$$ }' # Search for the usage of `ServiceType::Service`. rg --type rust 'ServiceType::Service'Length of output: 251
Script:
#!/bin/bash # Description: Refine the search for the definition of `UserType` and `ServiceType` enums and their variants. # Search for the definition of `UserType` enum. rg --type rust 'enum UserType' # Search for the definition of `ServiceType` enum. rg --type rust 'enum ServiceType' # Search for any usage of `UserType`. rg --type rust 'UserType' # Search for any usage of `ServiceType`. rg --type rust 'ServiceType'Length of output: 853
Script:
#!/bin/bash # Description: Extract the definitions of `UserType` and `ServiceType` enums from `crates/apub/src/actors/user.rs`. # Extract the definition of `UserType` enum. rg --type rust --context 10 'pub enum UserType' crates/apub/src/actors/user.rs # Extract the definition of `ServiceType` enum. rg --type rust --context 10 'ServiceType' crates/apub/src/actors/user.rsLength of output: 1469
Summary by CodeRabbit
Refactor
Service
toUser
across various modules to improve clarity and consistency.New Features
UserType
,UserAttachment
, andUserImage
to enhance user representation and functionality.Documentation