Skip to content

Commit

Permalink
fix: Show order buttons to admins (#5872)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamareebjamal authored Dec 2, 2020
1 parent b5ac09f commit 5c296b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/controllers/orders/view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classic from 'ember-classic-decorator';
import { action } from '@ember/object';
import { action, computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';

Expand All @@ -11,6 +11,11 @@ export default class ViewController extends Controller {
@service
printThis;

@computed('model.order.user', 'authManager.currentUser')
get showTicketsButton() {
return this.model.order.get('user.id') === this.authManager.currentUser.id || this.authManager.currentUser.isAdmin;
}

@action
downloadInvoice(eventName, orderId) {
this.set('isLoading', true);
Expand Down
2 changes: 1 addition & 1 deletion app/routes/events/view/tickets/orders/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class extends Route.extend(EmberTableRouteMixin) {
}

let queryString = {
include : 'tickets,user',
include : 'tickets,user,attendees',
filter : filterOptions,
'page[size]' : params.per_page || 10,
'page[number]' : params.page || 1
Expand Down
2 changes: 1 addition & 1 deletion app/templates/orders/view.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Orders::EventInfo
@data={{this.model.order}} />
<br/>
{{#if (eq this.model.order.user.id this.authManager.currentUser.id)}}
{{#if this.showTicketsButton}}
<div class="d-flex">
<button class="ui labeled icon flex-1 {{if this.isLoadingTickets 'loading'}} {{if this.device.isMobile 'fluid'}} button"
{{action this.downloadTickets this.model.event.name this.model.order.identifier}}>
Expand Down

1 comment on commit 5c296b5

@vercel
Copy link

@vercel vercel bot commented on 5c296b5 Dec 2, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.