diff --git a/ghost/admin/app/components/dashboard/charts/recents.hbs b/ghost/admin/app/components/dashboard/charts/recents.hbs index 14e9623ff0..e337e70a5a 100644 --- a/ghost/admin/app/components/dashboard/charts/recents.hbs +++ b/ghost/admin/app/components/dashboard/charts/recents.hbs @@ -104,7 +104,10 @@ {{#if parsedEvent.info}} ({{parsedEvent.info}}) {{/if}} - {{#if parsedEvent.url}} + {{#if parsedEvent.route}} + {{parsedEvent.join}} + {{parsedEvent.object}} + {{else if parsedEvent.url}} {{parsedEvent.join}} {{parsedEvent.object}} {{else if parsedEvent.email}} diff --git a/ghost/admin/app/components/member/activity-feed.hbs b/ghost/admin/app/components/member/activity-feed.hbs index e5c07b7fa4..f94d59739a 100644 --- a/ghost/admin/app/components/member/activity-feed.hbs +++ b/ghost/admin/app/components/member/activity-feed.hbs @@ -29,7 +29,10 @@ {{#if event.info}} ({{event.info}}) {{/if}} - {{#if event.url}} + {{#if event.route}} + {{event.join}} + {{event.object}} + {{else if event.url}} {{event.join}} {{event.object}} {{else if event.email}} diff --git a/ghost/admin/app/components/members-activity/table-row.hbs b/ghost/admin/app/components/members-activity/table-row.hbs index f8a2bf5d33..f1c31add86 100644 --- a/ghost/admin/app/components/members-activity/table-row.hbs +++ b/ghost/admin/app/components/members-activity/table-row.hbs @@ -1,5 +1,5 @@ {{#let (parse-member-event @event @hasMultipleNewsletters) as |event|}} - + {{#unless @hideMemberColumn}}
@@ -24,7 +24,10 @@ {{#if event.info}} ({{event.info}}) {{/if}} - {{#if event.url}} + {{#if event.route}} + {{event.join}} + {{event.object}} + {{else if event.url}} {{event.join}} {{event.object}} {{else if event.email}} diff --git a/ghost/admin/app/helpers/parse-member-event.js b/ghost/admin/app/helpers/parse-member-event.js index 87d0c1f77e..2ee681ce7a 100644 --- a/ghost/admin/app/helpers/parse-member-event.js +++ b/ghost/admin/app/helpers/parse-member-event.js @@ -19,6 +19,7 @@ export default class ParseMemberEventHelper extends Helper { const join = this.getJoin(event); const object = this.getObject(event); const url = this.getURL(event); + const route = this.getRoute(event); const timestamp = moment(event.data.created_at); const source = this.getSource(event); @@ -36,6 +37,7 @@ export default class ParseMemberEventHelper extends Helper { info, description, url, + route, timestamp }; } @@ -308,17 +310,41 @@ export default class ParseMemberEventHelper extends Helper { * Make the object clickable */ getURL(event) { - if (event.type === 'comment_event' || event.type === 'click_event' || event.type === 'feedback_event') { + if (['comment_event', 'click_event', 'feedback_event'].includes(event.type)) { if (event.data.post) { return event.data.post.url; } } - if (event.type === 'signup_event' || event.type === 'subscription_event') { + if (['signup_event', 'subscription_event'].includes(event.type)) { if (event.data.attribution && event.data.attribution.url) { return event.data.attribution.url; } } return; } + + /** + * Get internal route props for a clickable object + */ + getRoute(event) { + if (['comment_event', 'click_event', 'feedback_event'].includes(event.type)) { + if (event.data.post) { + return { + name: 'posts.analytics', + model: event.data.post.id + }; + } + } + + if (['signup_event', 'subscription_event'].includes(event.type)) { + if (event.data.attribution_type === 'post') { + return { + name: 'posts.analytics', + model: event.data.attribution_id + }; + } + } + return; + } }