Remove piwik config fallback for privacy policy URL (#9390)

* Remove piwik config fallback for privacy policy URL

* Clean up imports
This commit is contained in:
Travis Ralston 2022-10-12 10:08:39 -04:00 committed by GitHub
parent 533eda2273
commit 476ed0468f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 15 deletions

View File

@ -141,9 +141,6 @@ export interface IConfigOptions {
servers: string[]; servers: string[];
}; };
piwik?: false | {
policy_url: string; // deprecated in favour of `privacy_policy_url` at root instead
};
posthog?: { posthog?: {
project_api_key: string; project_api_key: string;
api_host: string; // hostname api_host: string; // hostname

View File

@ -28,8 +28,6 @@ import {
showDialog as showAnalyticsLearnMoreDialog, showDialog as showAnalyticsLearnMoreDialog,
} from "../components/views/dialogs/AnalyticsLearnMoreDialog"; } from "../components/views/dialogs/AnalyticsLearnMoreDialog";
import { Action } from "../dispatcher/actions"; import { Action } from "../dispatcher/actions";
import { SnakedObject } from "../utils/SnakedObject";
import { IConfigOptions } from "../IConfigOptions";
import SettingsStore from "../settings/SettingsStore"; import SettingsStore from "../settings/SettingsStore";
const onAccept = () => { const onAccept = () => {
@ -78,16 +76,7 @@ const onLearnMorePreviouslyOptedIn = () => {
const TOAST_KEY = "analytics"; const TOAST_KEY = "analytics";
export function getPolicyUrl(): Optional<string> { export function getPolicyUrl(): Optional<string> {
const policyUrl = SdkConfig.get("privacy_policy_url"); return SdkConfig.get("privacy_policy_url");
if (policyUrl) return policyUrl;
// Try get from legacy config location
const piwikConfig = SdkConfig.get("piwik");
let piwik: Optional<SnakedObject<Extract<IConfigOptions["piwik"], object>>>;
if (typeof piwikConfig === 'object') {
piwik = new SnakedObject(piwikConfig);
}
return piwik?.get("policy_url");
} }
export const showToast = (): void => { export const showToast = (): void => {