|
@@ -51,6 +51,23 @@ namespace ClankerSaddle {
|
|
|
return directives().notify("error", "Your account no longer exists.").navigate("/login");
|
|
return directives().notify("error", "Your account no longer exists.").navigate("/login");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ var slot = yield build_profile_slot(state_service, action_registry,
|
|
|
|
|
+ users_service, preferences, me, (!)user);
|
|
|
|
|
+ return directives().set(slot);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * The page's PAGE-scope profile slot. Shared with
|
|
|
|
|
+ * {@link SetThemeAction} so the save answers with the REFRESHED
|
|
|
|
|
+ * card (the same trick as the dashboard actions): the client
|
|
|
|
|
+ * re-renders every binding after a directive chain, and without
|
|
|
|
|
+ * this the theme radios would snap back against the stale
|
|
|
|
|
+ * pre-save values.
|
|
|
|
|
+ */
|
|
|
|
|
+ public static async Statum.Slot build_profile_slot(StateService state_service,
|
|
|
|
|
+ ActionRegistry action_registry, UserService users_service,
|
|
|
|
|
+ UserPreferenceService preferences, CurrentUser me, UserProjection user)
|
|
|
|
|
+ throws GLib.Error {
|
|
|
// The appearance card's current values: the stored
|
|
// The appearance card's current values: the stored
|
|
|
// preferences (missing rows read as the defaults — the
|
|
// preferences (missing rows read as the defaults — the
|
|
|
// core theme, auto mode).
|
|
// core theme, auto mode).
|
|
@@ -64,12 +81,12 @@ namespace ClankerSaddle {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var view = new ProfileView() {
|
|
var view = new ProfileView() {
|
|
|
- username = ((!)user).username,
|
|
|
|
|
- email = ((!)user).email,
|
|
|
|
|
- name_display = @"$(((!)user).forename) $(((!)user).surname)".strip(),
|
|
|
|
|
- is_admin = SpryAuth.permission_matches(((!)user).permissions.to_array(),
|
|
|
|
|
|
|
+ username = user.username,
|
|
|
|
|
+ email = user.email,
|
|
|
|
|
+ name_display = @"$(user.forename) $(user.surname)".strip(),
|
|
|
|
|
+ is_admin = SpryAuth.permission_matches(user.permissions.to_array(),
|
|
|
SpryAuth.ADMIN_PERMISSION),
|
|
SpryAuth.ADMIN_PERMISSION),
|
|
|
- created_display = format_stamp(((!)user).created),
|
|
|
|
|
|
|
+ created_display = format_stamp(user.created),
|
|
|
change_password = action_registry.author<ChangeMyPasswordAction>(),
|
|
change_password = action_registry.author<ChangeMyPasswordAction>(),
|
|
|
theme = theme,
|
|
theme = theme,
|
|
|
mode = mode,
|
|
mode = mode,
|
|
@@ -78,12 +95,11 @@ namespace ClankerSaddle {
|
|
|
|
|
|
|
|
var props = (PropertyDictionary) GObjectMapping.to_properties(view);
|
|
var props = (PropertyDictionary) GObjectMapping.to_properties(view);
|
|
|
|
|
|
|
|
- var slot = state_service.new_slot(Scope.PAGE, new State() {
|
|
|
|
|
|
|
+ return state_service.new_slot(Scope.PAGE, new State() {
|
|
|
type_name = "profile",
|
|
type_name = "profile",
|
|
|
public_data = props,
|
|
public_data = props,
|
|
|
private_data = new PropertyDictionary()
|
|
private_data = new PropertyDictionary()
|
|
|
});
|
|
});
|
|
|
- return directives().set(slot);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|