Add team preference to use logo for branding (#4285)

* feat: add team preference to use logo for branding

* fix: allow on cloud version too
This commit is contained in:
Apoorv Mishra
2022-10-19 10:01:24 +05:30
committed by GitHub
parent 98f997387c
commit bb21fa725c
11 changed files with 27 additions and 17 deletions

View File

@@ -167,9 +167,6 @@ SMTP_REPLY_EMAIL=
SMTP_TLS_CIPHERS= SMTP_TLS_CIPHERS=
SMTP_SECURE=true SMTP_SECURE=true
# Custom logo that displays on the authentication screen, scaled to height: 60px
# TEAM_LOGO=https://example.com/images/logo.png
# The default interface language. See translate.getoutline.com for a list of # The default interface language. See translate.getoutline.com for a list of
# available language codes and their rough percentage translated. # available language codes and their rough percentage translated.
DEFAULT_LANGUAGE=en_US DEFAULT_LANGUAGE=en_US

View File

@@ -199,10 +199,6 @@
"description": "A sentry tunnel URL for bypassing ad blockers in the UI (optional)", "description": "A sentry tunnel URL for bypassing ad blockers in the UI (optional)",
"required": false "required": false
}, },
"TEAM_LOGO": {
"description": "A logo that will be displayed on the signed out home page",
"required": false
},
"DEFAULT_LANGUAGE": { "DEFAULT_LANGUAGE": {
"value": "en_US", "value": "en_US",
"description": "The default interface language. See translate.getoutline.com for a list of available language codes and their rough percentage translated.", "description": "The default interface language. See translate.getoutline.com for a list of available language codes and their rough percentage translated.",

View File

@@ -130,7 +130,7 @@ const useAuthorizedSettingsConfig = () => {
name: t("Features"), name: t("Features"),
path: "/settings/features", path: "/settings/features",
component: Features, component: Features,
enabled: can.update && team.collaborativeEditing, enabled: can.update,
group: t("Team"), group: t("Team"),
icon: BeakerIcon, icon: BeakerIcon,
}, },

View File

@@ -174,8 +174,8 @@ function Login({ children }: Props) {
<Centered align="center" justify="center" gap={12} column auto> <Centered align="center" justify="center" gap={12} column auto>
<PageTitle title={t("Login")} /> <PageTitle title={t("Login")} />
<Logo> <Logo>
{env.TEAM_LOGO && !isCloudHosted ? ( {config.logo ? (
<TeamLogo src={env.TEAM_LOGO} /> <TeamLogo src={config.logo} />
) : ( ) : (
<OutlineLogo size={38} fill="currentColor" /> <OutlineLogo size={38} fill="currentColor" />
)} )}

View File

@@ -57,6 +57,22 @@ function Features() {
/> />
</SettingRow> </SettingRow>
)} )}
{team.avatarUrl && (
<SettingRow
name="publicBranding"
label={t("Public branding")}
description={t(
"Show your teams logo on public pages like login and shared documents."
)}
>
<Switch
id="publicBranding"
name="publicBranding"
checked={!!team.preferences?.publicBranding}
onChange={handlePreferenceChange}
/>
</SettingRow>
)}
</Scene> </Scene>
); );
} }

View File

@@ -29,6 +29,7 @@ type Provider = {
export type Config = { export type Config = {
name?: string; name?: string;
logo?: string;
hostname?: string; hostname?: string;
providers: Provider[]; providers: Provider[];
}; };

View File

@@ -197,11 +197,6 @@ export class Environment {
@IsOptional() @IsOptional()
public DEPLOYMENT = this.toOptionalString(process.env.DEPLOYMENT); public DEPLOYMENT = this.toOptionalString(process.env.DEPLOYMENT);
/**
* Custom company logo that displays on the authentication screen.
*/
public TEAM_LOGO = process.env.TEAM_LOGO;
/** /**
* The default interface language. See translate.getoutline.com for a list of * The default interface language. See translate.getoutline.com for a list of
* available language codes and their percentage translated. * available language codes and their percentage translated.

View File

@@ -16,7 +16,6 @@ export default function present(env: Environment): PublicEnv {
ENVIRONMENT: env.ENVIRONMENT, ENVIRONMENT: env.ENVIRONMENT,
SENTRY_DSN: env.SENTRY_DSN, SENTRY_DSN: env.SENTRY_DSN,
SENTRY_TUNNEL: env.SENTRY_TUNNEL, SENTRY_TUNNEL: env.SENTRY_TUNNEL,
TEAM_LOGO: env.TEAM_LOGO,
SLACK_CLIENT_ID: env.SLACK_CLIENT_ID, SLACK_CLIENT_ID: env.SLACK_CLIENT_ID,
SLACK_APP_ID: env.SLACK_APP_ID, SLACK_APP_ID: env.SLACK_APP_ID,
MAXIMUM_IMPORT_SIZE: env.MAXIMUM_IMPORT_SIZE, MAXIMUM_IMPORT_SIZE: env.MAXIMUM_IMPORT_SIZE,

View File

@@ -54,6 +54,7 @@ router.post("auth.config", async (ctx) => {
ctx.body = { ctx.body = {
data: { data: {
name: team.name, name: team.name,
logo: team.preferences?.publicBranding ? team.avatarUrl : undefined,
providers: filterProviders(team), providers: filterProviders(team),
}, },
}; };
@@ -74,6 +75,7 @@ router.post("auth.config", async (ctx) => {
ctx.body = { ctx.body = {
data: { data: {
name: team.name, name: team.name,
logo: team.preferences?.publicBranding ? team.avatarUrl : undefined,
hostname: ctx.request.hostname, hostname: ctx.request.hostname,
providers: filterProviders(team), providers: filterProviders(team),
}, },
@@ -95,6 +97,7 @@ router.post("auth.config", async (ctx) => {
ctx.body = { ctx.body = {
data: { data: {
name: team.name, name: team.name,
logo: team.preferences?.publicBranding ? team.avatarUrl : undefined,
hostname: ctx.request.hostname, hostname: ctx.request.hostname,
providers: filterProviders(team), providers: filterProviders(team),
}, },

View File

@@ -659,6 +659,8 @@
"Manage optional and beta features. Changing these settings will affect the experience for all members of the workspace.": "Manage optional and beta features. Changing these settings will affect the experience for all members of the workspace.", "Manage optional and beta features. Changing these settings will affect the experience for all members of the workspace.": "Manage optional and beta features. Changing these settings will affect the experience for all members of the workspace.",
"Seamless editing": "Seamless editing", "Seamless editing": "Seamless editing",
"When enabled documents are always editable for team members that have permission. When disabled there is a separate editing view.": "When enabled documents are always editable for team members that have permission. When disabled there is a separate editing view.", "When enabled documents are always editable for team members that have permission. When disabled there is a separate editing view.": "When enabled documents are always editable for team members that have permission. When disabled there is a separate editing view.",
"Public branding": "Public branding",
"Show your teams logo on public pages like login and shared documents.": "Show your teams logo on public pages like login and shared documents.",
"New group": "New group", "New group": "New group",
"Groups can be used to organize and manage the people on your team.": "Groups can be used to organize and manage the people on your team.", "Groups can be used to organize and manage the people on your team.": "Groups can be used to organize and manage the people on your team.",
"All groups": "All groups", "All groups": "All groups",

View File

@@ -12,7 +12,6 @@ export type PublicEnv = {
ENVIRONMENT: string; ENVIRONMENT: string;
SENTRY_DSN: string | undefined; SENTRY_DSN: string | undefined;
SENTRY_TUNNEL: string | undefined; SENTRY_TUNNEL: string | undefined;
TEAM_LOGO: string | undefined;
SLACK_CLIENT_ID: string | undefined; SLACK_CLIENT_ID: string | undefined;
SLACK_APP_ID: string | undefined; SLACK_APP_ID: string | undefined;
MAXIMUM_IMPORT_SIZE: number; MAXIMUM_IMPORT_SIZE: number;
@@ -57,6 +56,8 @@ export type UserPreferences = { [key in UserPreference]?: boolean };
export enum TeamPreference { export enum TeamPreference {
/** Whether documents have a separate edit mode instead of seamless editing. */ /** Whether documents have a separate edit mode instead of seamless editing. */
SeamlessEdit = "seamlessEdit", SeamlessEdit = "seamlessEdit",
/** Whether to use team logo across the app for branding. */
PublicBranding = "publicBranding",
} }
export type TeamPreferences = { [key in TeamPreference]?: boolean }; export type TeamPreferences = { [key in TeamPreference]?: boolean };