From e5fb7b805f3140d0a44ec4da3288dc8be787a37d Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 23 Sep 2022 20:50:11 +0530 Subject: [PATCH] Wired referrer information on member detail page refs https://github.com/TryGhost/Ghost/pull/15463 --- ghost/admin/app/components/gh-member-details.hbs | 2 +- ghost/admin/app/components/gh-member-details.js | 10 +++++++++- ghost/admin/app/components/gh-member-settings-form.hbs | 2 +- ghost/admin/app/components/gh-member-settings-form.js | 5 +++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ghost/admin/app/components/gh-member-details.hbs b/ghost/admin/app/components/gh-member-details.hbs index f3c6497d06..946913419d 100644 --- a/ghost/admin/app/components/gh-member-details.hbs +++ b/ghost/admin/app/components/gh-member-details.hbs @@ -73,7 +73,7 @@

{{svg-jar "earth"}} - Coming from 

Twitter / Social

+ Coming from 

{{this.referrerAttribution.source}} / {{this.referrerAttribution.medium}}

{{/if}} diff --git a/ghost/admin/app/components/gh-member-details.js b/ghost/admin/app/components/gh-member-details.js index 2b0d1585ca..ff0d34d89b 100644 --- a/ghost/admin/app/components/gh-member-details.js +++ b/ghost/admin/app/components/gh-member-details.js @@ -3,4 +3,12 @@ import {inject as service} from '@ember/service'; export default class extends Component { @service settings; -} \ No newline at end of file + + get referrerAttribution() { + const attribution = this.args.member?.attribution; + return { + source: attribution?.referrer_source || 'Unknown', + medium: attribution?.referrer_medium || '-' + }; + } +} diff --git a/ghost/admin/app/components/gh-member-settings-form.hbs b/ghost/admin/app/components/gh-member-settings-form.hbs index 87268d796e..cb9e71b3ca 100644 --- a/ghost/admin/app/components/gh-member-settings-form.hbs +++ b/ghost/admin/app/components/gh-member-settings-form.hbs @@ -217,7 +217,7 @@

Subscription Source

-

Twitter / Social

+

{{sub.attribution.referrerSource}} / {{sub.attribution.referrerMedium}}

{{#if (and sub.attribution sub.attribution.url sub.attribution.title)}}
diff --git a/ghost/admin/app/components/gh-member-settings-form.js b/ghost/admin/app/components/gh-member-settings-form.js index b4fda70a53..1358d21255 100644 --- a/ghost/admin/app/components/gh-member-settings-form.js +++ b/ghost/admin/app/components/gh-member-settings-form.js @@ -73,6 +73,11 @@ export default class extends Component { }).map((sub) => { const data = { ...sub, + attribution: { + ...sub.attribution, + referrerSource: sub.attribution?.referrer_source || 'Unknown', + referrerMedium: sub.attribution?.referrer_medium || '-' + }, startDate: sub.start_date ? moment(sub.start_date).format('D MMM YYYY') : '-', validUntil: sub.current_period_end ? moment(sub.current_period_end).format('D MMM YYYY') : '-', cancellationReason: sub.cancellation_reason,