Seed predefined rules at startup without requiring Warp auth
Previously, predefined rules (11 system-defined behavioral rules) were
only seeded when the user navigated to the Rules settings page, and
required a cloud-authenticated owner to create cloud objects.
Since Galaxy operates without Warp cloud auth:
1. personal_drive() now returns a synthetic local owner
('local-galaxy-user') when not authenticated, allowing cloud objects
(rules, etc.) to be created and stored locally in SQLite.
2. seed_predefined_rules_if_needed() runs at app startup (after
CloudModel and UpdateManager are initialized) to seed rules on
first launch without requiring the user to visit settings.
Rules are now visible in Galaxy Drive > Rules on first launch.
This commit is contained in:
@@ -717,10 +717,18 @@ impl UserWorkspaces {
|
||||
// Returns the [`Owner`] for the user's personal drive. If the user is not authenticated, this
|
||||
// returns `None`.
|
||||
pub fn personal_drive(&self, ctx: &AppContext) -> Option<Owner> {
|
||||
AuthStateProvider::as_ref(ctx)
|
||||
.get()
|
||||
.user_id()
|
||||
.map(|user_uid| Owner::User { user_uid })
|
||||
// Return the authenticated user's ID if available, otherwise provide a
|
||||
// synthetic local owner so cloud objects (rules, etc.) can be created and
|
||||
// stored locally without requiring Warp authentication.
|
||||
Some(
|
||||
AuthStateProvider::as_ref(ctx)
|
||||
.get()
|
||||
.user_id()
|
||||
.map(|user_uid| Owner::User { user_uid })
|
||||
.unwrap_or_else(|| Owner::User {
|
||||
user_uid: UserUid::new("local-galaxy-user"),
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
// Maps a [`Space`] into an [`Owner`], based on the user's team memberships. If the space
|
||||
|
||||
Reference in New Issue
Block a user