mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Fixed member page breadcrumbs coming from analytics
fixes https://github.com/TryGhost/Team/issues/2140
This commit is contained in:
parent
b916300ceb
commit
2903a30d39
@ -27,6 +27,9 @@ export default class MemberController extends Controller {
|
||||
_previousLabels = null;
|
||||
_previousNewsletters = null;
|
||||
|
||||
directlyFromAnalytics = false;
|
||||
fromAnalytics = null;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._availableLabels = this.store.peekAll('label');
|
||||
|
@ -34,6 +34,7 @@ export default class MembersRoute extends AdminRoute {
|
||||
controller.fetchMemberTask.perform(member.id);
|
||||
}
|
||||
|
||||
controller.directlyFromAnalytics = false;
|
||||
if (transition.from?.name === 'posts.analytics') {
|
||||
// Sadly transition.from.params is not reliable to use (not populated on transitions)
|
||||
const oldParams = transition.router?.oldState?.params['posts.analytics'] ?? {};
|
||||
@ -41,6 +42,7 @@ export default class MembersRoute extends AdminRoute {
|
||||
// We need to store analytics in 'this' to have it accessible for the member route
|
||||
this.fromAnalytics = Object.values(oldParams);
|
||||
controller.fromAnalytics = this.fromAnalytics;
|
||||
controller.directlyFromAnalytics = true;
|
||||
} else if (transition.from?.metadata?.fromAnalytics) {
|
||||
// Handle returning from member route
|
||||
const fromAnalytics = transition.from?.metadata.fromAnalytics ?? null;
|
||||
|
@ -10,10 +10,14 @@
|
||||
<LinkTo @route="posts.analytics" @models={{this.fromAnalytics}}>
|
||||
Analytics
|
||||
</LinkTo>
|
||||
{{svg-jar "arrow-right-small"}}
|
||||
<LinkTo @route="members" data-test-link="members-back">
|
||||
Members
|
||||
</LinkTo>
|
||||
|
||||
{{#unless this.directlyFromAnalytics}}
|
||||
{{svg-jar "arrow-right-small"}}
|
||||
<LinkTo @route="members" data-test-link="members-back">
|
||||
Members
|
||||
</LinkTo>
|
||||
{{/unless}}
|
||||
|
||||
{{svg-jar "arrow-right-small"}} {{if this.member.isNew "New member" "Edit member"}}
|
||||
</div>
|
||||
{{else}}
|
||||
|
Loading…
Reference in New Issue
Block a user