Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Remove piwik config fallback for privacy policy URL (#9390)
Browse files Browse the repository at this point in the history
* Remove piwik config fallback for privacy policy URL

* Clean up imports
  • Loading branch information
turt2live authored Oct 12, 2022
1 parent 533eda2 commit 476ed04
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
3 changes: 0 additions & 3 deletions src/IConfigOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ export interface IConfigOptions {
servers: string[];
};

piwik?: false | {
policy_url: string; // deprecated in favour of `privacy_policy_url` at root instead
};
posthog?: {
project_api_key: string;
api_host: string; // hostname
Expand Down
13 changes: 1 addition & 12 deletions src/toasts/AnalyticsToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
showDialog as showAnalyticsLearnMoreDialog,
} from "../components/views/dialogs/AnalyticsLearnMoreDialog";
import { Action } from "../dispatcher/actions";
import { SnakedObject } from "../utils/SnakedObject";
import { IConfigOptions } from "../IConfigOptions";
import SettingsStore from "../settings/SettingsStore";

const onAccept = () => {
Expand Down Expand Up @@ -78,16 +76,7 @@ const onLearnMorePreviouslyOptedIn = () => {
const TOAST_KEY = "analytics";

export function getPolicyUrl(): Optional<string> {
const policyUrl = 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");
return SdkConfig.get("privacy_policy_url");
}

export const showToast = (): void => {
Expand Down

0 comments on commit 476ed04

Please sign in to comment.