0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Reverted "Fixed PostHog toolbar in admin (#19675)" (#19680)

This reverts commit c32ee3ca40.

- I found another way to fix this, making this change unnecessary
This commit is contained in:
Chris Raible 2024-02-08 16:58:46 -08:00 committed by GitHub
parent c32ee3ca40
commit 59076d1bca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 25 deletions

View file

@ -1,8 +1,8 @@
import Component from '@glimmer/component';
import trackEvent from '../utils/analytics';
import {action} from '@ember/object';
import {inject} from 'ghost-admin/decorators/inject';
import {inject as service} from '@ember/service';
import {trackEvent} from '../utils/analytics';
import {tracked} from '@glimmer/tracking';
export default class KoenigImageEditor extends Component {

View file

@ -1,5 +1,4 @@
import Route from '@ember/routing/route';
import {loadToolbar} from '../utils/analytics';
import {inject as service} from '@ember/service';
export default class HomeRoute extends Route {
@ -10,8 +9,6 @@ export default class HomeRoute extends Route {
beforeModel(transition) {
super.beforeModel(...arguments);
loadToolbar();
if (transition.to?.queryParams?.firstStart === 'true') {
return this.router.transitionTo('setup.done');
}

View file

@ -1,28 +1,8 @@
// Wrapper function for Plausible event
export function trackEvent(eventName, props = {}) {
export default function trackEvent(eventName, props = {}) {
window.plausible = window.plausible || function () {
(window.plausible.q = window.plausible.q || []).push(arguments);
};
window.plausible(eventName, {props: props});
}
/**
* Load the PostHog toolbar if available
* window.posthog must be available for this to do anything
* This function needs to be called before the Admin App is fully initialized
* because the Admin App overwrites the #__posthog hash with its own routing
* before the PostHog snippet can read it and load the toolbar itself.
* @returns {void}
*/
export function loadToolbar() {
try {
const toolbarJSON = new URLSearchParams(window.location.hash.substring(1)).get('__posthog');
if (toolbarJSON && window.posthog) {
window.posthog.loadToolbar(JSON.parse(toolbarJSON));
}
} catch (e) {
// fail silently
}
}