Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/routes/events/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default Route.extend({

model(params) {
return this.store.findRecord('event', params.event_id, {
include: 'event-topic,event-sub-topic,event-type,event-copyright,tax,stripe-authorization'
include: 'event-topic,event-sub-topic,event-type,event-copyright,tax,owner,stripe-authorization'
});
},

Expand Down
6 changes: 6 additions & 0 deletions app/routes/events/view/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ export default Route.extend({
titleToken() {
return this.l10n.t('Settings');
},
beforeModel() {
let { currentUser } = this.authManager;
Copy link
Contributor

@abhinavk96 abhinavk96 Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can this.authManager be currentUser?

Copy link
Member

@iamareebjamal iamareebjamal Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent to let currentUser = this.authManager.currentUser

if (!(currentUser.isAnAdmin || this.modelFor('events.view').owner.get('email') === currentUser.email)) {
this.transitionTo('events.view');
}
},
async model() {
let eventDetails = this.modelFor('events.view');
return {
Expand Down
8 changes: 5 additions & 3 deletions app/templates/events/view.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@
{{#link-to 'events.view.export' class='item'}}
{{t 'Export'}}
{{/link-to}}
{{#link-to 'events.view.settings' class='item'}}
{{t 'Settings'}}
{{/link-to}}
{{#if (or authManager.currentUser.isAnAdmin (eq model.owner.email authManager.currentUser.email))}}
{{#link-to 'events.view.settings' class='item'}}
{{t 'Settings'}}
{{/link-to}}
{{/if}}
{{/tabbed-navigation}}
</div>
</div>
Expand Down