fix(setup): hide YouTube/Google affordances when Google sign-in isn't configured
- /api/me exposes instance-wide google_enabled. The onboarding nudge no longer auto-opens, and Settings hides the YouTube-access section + the 'Connect Google' option, when the instance has no Google OAuth configured (e.g. an email+password-only self-host). A linked account still shows its 'Connected' status.
This commit is contained in:
parent
97865c50cc
commit
c2a388e4ea
4 changed files with 53 additions and 28 deletions
|
|
@ -11,6 +11,7 @@ export interface Me {
|
|||
is_demo: boolean;
|
||||
has_google: boolean;
|
||||
has_password: boolean;
|
||||
google_enabled: boolean;
|
||||
can_read: boolean;
|
||||
can_write: boolean;
|
||||
pending_invites: number;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,16 @@
|
|||
export const ONBOARD_ACTIVE = "subfeed.onboarding.active";
|
||||
export const ONBOARD_DISMISSED = "subfeed.onboarding.dismissed";
|
||||
|
||||
export function shouldAutoOpenOnboarding(me: { can_read: boolean; is_demo?: boolean }): boolean {
|
||||
export function shouldAutoOpenOnboarding(me: {
|
||||
can_read: boolean;
|
||||
is_demo?: boolean;
|
||||
google_enabled?: boolean;
|
||||
}): boolean {
|
||||
// The shared demo account can never connect YouTube, so never nudge it to.
|
||||
if (me.is_demo) return false;
|
||||
// YouTube connect needs Google OAuth configured on this instance. A self-host instance may run
|
||||
// email+password only — then there's nothing to connect, so don't nudge.
|
||||
if (me.google_enabled === false) return false;
|
||||
if (sessionStorage.getItem(ONBOARD_ACTIVE)) return true;
|
||||
return !me.can_read && !localStorage.getItem(ONBOARD_DISMISSED);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue