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
4 changes: 2 additions & 2 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, FastbootAdapter,
const headers = {
'Content-Type': 'application/vnd.api+json'
};
const { access_token } = this.get('session.data.authenticated');
const { access_token } = this.session.data.authenticated;
if (access_token) {
headers[ENV['ember-simple-auth-token'].authorizationHeaderName] = ENV['ember-simple-auth-token'].authorizationPrefix + access_token;
}
Expand Down Expand Up @@ -84,7 +84,7 @@ export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, FastbootAdapter,
@param {Number} status The response status as received from the API
*/
ensureResponseAuthorized(status) {
if (status === 401 && this.get('session.isAuthenticated')) {
if (status === 401 && this.session.isAuthenticated) {
this.session.invalidate();
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/account/application-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default Component.extend({
this.authManager.persistCurrentUser(
await this.store.findRecord('user', tokenPayload.identity)
);
this.set('data', this.get('authManager.currentUser'));
this.set('data', this.authManager.currentUser);
}

this.set('isLoading', false);
Expand Down
2 changes: 1 addition & 1 deletion app/components/account/danger-zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Component from '@ember/component';
export default Component.extend({

isUserDeletable: computed('data.events', 'data.orders', function() {
if (this.get('data.events').length || this.get('data.orders').length) {
if (this.data.events.length || this.data.orders.length) {
return false;
}
return true;
Expand Down
6 changes: 5 additions & 1 deletion app/components/event-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export default Component.extend({
classNames: ['column'],

tags: computed('event.type', 'event.topic', 'event.subTopic', function() {
const tagsOriginal = this.getProperties('event.topic.name', 'event.type.name', 'event.subTopic.name');
// Unfortunately, due to the extremely dynamic and stringy nature
// of ember, the next line crashes on using object destructuring
// and we don't have time and resources to chase down issues originating
// from ember core, hence disabling the lint
const tagsOriginal = this.getProperties('event.topic.name', 'event.type.name', 'event.subTopic.name'); // eslint-disable-line ember/no-get
let tags = [];
forOwn(tagsOriginal, value => {
if (value && value.trim() !== '') {
Expand Down
2 changes: 1 addition & 1 deletion app/components/events/view/export/download-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default Component.extend({
startExportTask() {
this.set('isLoading', true);
this.loader
.load(`/events/${this.get('model.id')}/export/${this.fileFormat}`)
.load(`/events/${this.model.id}/export/${this.fileFormat}`)
.then(exportJobInfo => {
this.requestLoop(exportJobInfo);
})
Expand Down
6 changes: 3 additions & 3 deletions app/components/events/view/overview/manage-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default Component.extend({
classNames : ['ui', 'fluid', 'card'],
roleType : 'accepted',
roleInvites : computed('data.roleInvites.@each', 'roleType', function() {
return this.get('data.roleInvites').filterBy('status', this.roleType);
return this.data.roleInvites.filterBy('status', this.roleType);
}),
actions: {
openAddUserRoleModal(invite) {
Expand All @@ -25,7 +25,7 @@ export default Component.extend({
this.currentInvite.save()
.then(() => {
if (this.isNewInvite) {
this.get('data.roleInvites').addObject(this.currentInvite);
this.data.roleInvites.addObject(this.currentInvite);
}
this.set('isAddUserRoleModalOpen', false);
this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully'), {
Expand All @@ -49,7 +49,7 @@ export default Component.extend({
this.notify.success(this.l10n.t('Role Invite deleted successfully'), {
id: 'del_role_succ'
});
this.get('data.roleInvites').removeObject(invite);
this.data.roleInvites.removeObject(invite);
})
.catch(e => {
console.error('Error while deleting role invite', e);
Expand Down
8 changes: 4 additions & 4 deletions app/components/forms/admin/settings/payment-gateway-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,23 @@ export default Component.extend(FormMixin, {
},

isCheckedStripe: computed(function() {
return this.get('settings.stripeClientId') || this.get('settings.stripeTestClientId');
return this.settings.stripeClientId || this.settings.stripeTestClientId;
}),

stripeMode: computed(function() {
return ENV.environment === 'development' || ENV.environment === 'test' ? 'debug' : 'production';
}),

isCheckedPaypal: computed(function() {
return this.get('settings.paypalSandboxClient') || this.get('settings.paypalClient');
return this.settings.paypalSandboxClient || this.settings.paypalClient;
}),

isCheckedOmise: computed(function() {
return this.get('settings.omiseTestPublic') || this.get('settings.omiseLivePublic');
return this.settings.omiseTestPublic || this.settings.omiseLivePublic;
}),

isCheckedAliPay: computed('settings.alipaySecretKey', 'settings.alipayPublishableKey', function() {
return this.get('settings.alipaySecretKey') && this.get('settings.alipayPublishableKey');
return this.settings.alipaySecretKey && this.settings.alipayPublishableKey;
}),

actions: {
Expand Down
20 changes: 10 additions & 10 deletions app/components/forms/events/view/create-access-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { later } from '@ember/runloop';
export default Component.extend(FormMixin, {
getValidationRules() {
window.$.fn.form.settings.rules.checkMaxMin = () => {
return this.get('data.minQuantity') <= this.get('data.maxQuantity');
return this.data.minQuantity <= this.data.maxQuantity;
};
window.$.fn.form.settings.rules.checkMaxTotal = () => {
return this.get('data.maxQuantity') <= this.get('data.ticketsNumber');
return this.data.maxQuantity <= this.data.ticketsNumber;
};
return {
inline : true,
Expand Down Expand Up @@ -100,16 +100,16 @@ export default Component.extend(FormMixin, {
},
accessCode : '',
accessLink : computed('data.code', function() {
const params = this.get('router._router.currentState.routerJsState.params');
const origin = this.get('fastboot.isFastBoot') ? `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}` : location.origin;
let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { code: this.get('data.code') } });
const { params } = this.router._router.currentState.routerJsState;
const origin = this.fastboot.isFastBoot ? `${this.fastboot.request.protocol}//${this.fastboot.request.host}` : location.origin;
let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { code: this.data.code } });
this.set('data.accessUrl', link);
return link;
}),
hiddenTickets: computed.filterBy('tickets', 'isHidden', true),

allTicketTypesChecked: computed('tickets', function() {
if (this.hiddenTickets.length && this.get('data.tickets').length === this.hiddenTickets.length) {
if (this.hiddenTickets.length && this.data.tickets.length === this.hiddenTickets.length) {
return true;
}
return false;
Expand All @@ -124,21 +124,21 @@ export default Component.extend(FormMixin, {
if (allTicketTypesChecked) {
this.set('data.tickets', tickets.slice());
} else {
this.get('data.tickets').clear();
this.data.tickets.clear();
}
tickets.forEach(ticket => {
ticket.set('isChecked', allTicketTypesChecked);
});
},
updateTicketsSelection(ticket) {
if (!ticket.get('isChecked')) {
this.get('data.tickets').pushObject(ticket);
this.data.tickets.pushObject(ticket);
ticket.set('isChecked', true);
if (this.get('data.tickets').length === this.hiddenTickets.length) {
if (this.data.tickets.length === this.hiddenTickets.length) {
this.set('allTicketTypesChecked', true);
}
} else {
this.get('data.tickets').removeObject(ticket);
this.data.tickets.removeObject(ticket);
ticket.set('isChecked', false);
this.set('allTicketTypesChecked', false);
}
Expand Down
20 changes: 10 additions & 10 deletions app/components/forms/events/view/create-discount-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { currencySymbol } from 'open-event-frontend/helpers/currency-symbol';
export default Component.extend(FormMixin, {
getValidationRules() {
window.$.fn.form.settings.rules.checkMaxMin = () => {
return this.get('data.minQuantity') <= this.get('data.maxQuantity');
return this.data.minQuantity <= this.data.maxQuantity;
};
window.$.fn.form.settings.rules.checkMaxTotal = () => {
return this.get('data.maxQuantity') <= this.get('data.ticketsNumber');
return this.data.maxQuantity <= this.data.ticketsNumber;
};
window.$.fn.form.settings.rules.checkTicketSelected = () => {
let tickets = this.eventTickets;
Expand Down Expand Up @@ -113,9 +113,9 @@ export default Component.extend(FormMixin, {
};
},
discountLink: computed('data.code', function() {
const params = this.get('router._router.currentState.routerJsState.params');
const origin = this.get('fastboot.isFastBoot') ? `${this.get('fastboot.request.protocol')}//${this.get('fastboot.request.host')}` : location.origin;
let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { code: this.get('data.code') } });
const { params } = this.router._router.currentState.routerJsState;
const origin = this.fastboot.isFastBoot ? `${this.fastboot.request.protocol}//${this.fastboot.request.host}` : location.origin;
let link = origin + this.router.urlFor('public', params['events.view'].event_id, { queryParams: { code: this.data.code } });
this.set('data.discountUrl', link);
return link;
}),
Expand All @@ -127,7 +127,7 @@ export default Component.extend(FormMixin, {
eventTickets: computed.filterBy('tickets', 'type', 'paid'),

allTicketTypesChecked: computed('tickets', function() {
if (this.eventTickets.length && this.get('data.tickets').length === this.eventTickets.length) {
if (this.eventTickets.length && this.data.tickets.length === this.eventTickets.length) {
return true;
}
return false;
Expand All @@ -142,21 +142,21 @@ export default Component.extend(FormMixin, {
if (allTicketTypesChecked) {
this.set('data.tickets', tickets.slice());
} else {
this.get('data.tickets').clear();
this.data.tickets.clear();
}
tickets.forEach(ticket => {
ticket.set('isChecked', allTicketTypesChecked);
});
},
updateTicketsSelection(ticket) {
if (!ticket.get('isChecked')) {
this.get('data.tickets').pushObject(ticket);
this.data.tickets.pushObject(ticket);
ticket.set('isChecked', true);
if (this.get('data.tickets').length === this.eventTickets.length) {
if (this.data.tickets.length === this.eventTickets.length) {
this.set('allTicketTypesChecked', true);
}
} else {
this.get('data.tickets').removeObject(ticket);
this.data.tickets.removeObject(ticket);
ticket.set('isChecked', false);
this.set('allTicketTypesChecked', false);
}
Expand Down
14 changes: 7 additions & 7 deletions app/components/forms/orders/order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default Component.extend(FormMixin, {
buyerHasFirstName : readOnly('data.user.firstName'),
buyerHasLastName : readOnly('data.user.lastName'),
holders : computed('data.attendees', function() {
this.get('data.attendees').forEach(attendee => {
this.data.attendees.forEach(attendee => {
attendee.set('firstname', '');
attendee.set('lastname', '');
attendee.set('email', '');
});
return this.get('data.attendees');
return this.data.attendees;
}),
isPaidOrder: computed('data', function() {
if (!this.get('data.amount')) {
if (!this.data.amount) {
this.data.set('paymentMode', 'free');
return false;
}
Expand All @@ -44,9 +44,9 @@ export default Component.extend(FormMixin, {
}),

getRemainingTime: computed('settings', function() {
let orderExpiryTime = this.get('settings.orderExpiryTime');
let willExpireAt = this.get('data.createdAt').add(orderExpiryTime, 'minutes');
this.timer(willExpireAt, this.get('data.identifier'));
let { orderExpiryTime } = this.settings;
let willExpireAt = this.data.createdAt.add(orderExpiryTime, 'minutes');
this.timer(willExpireAt, this.data.identifier);
}),

timer(willExpireAt, orderIdentifier) {
Expand Down Expand Up @@ -485,7 +485,7 @@ export default Component.extend(FormMixin, {
actions: {
submit(data) {
this.onValid(() => {
let currentUser = this.get('data.user');
let currentUser = this.data.user;
currentUser.set('firstName', this.buyerFirstName);
currentUser.set('lastName', this.buyerLastName);
this.sendAction('save', data);
Expand Down
6 changes: 3 additions & 3 deletions app/components/forms/reset-password-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ export default Component.extend(FormMixin, {
},

didInsertElement() {
if (this.get('session.newUser')) {
this.set('newUser', this.get('session.newUser'));
this.set('identification', this.get('session.newUser'));
if (this.session.newUser) {
this.set('newUser', this.session.newUser);
this.set('identification', this.session.newUser);
this.set('session.newUser', null);
}
}
Expand Down
8 changes: 4 additions & 4 deletions app/components/forms/session-speaker-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,12 @@ export default Component.extend(FormMixin, {
}
},
didInsertElement() {
if (this.isSpeaker && this.get('data.speaker') && this.get('data.speaker').length) {
this.set('data.speaker', this.get('data.speaker').toArray()[0]);
if (this.isSpeaker && this.data.speaker && this.data.speaker.length) {
this.set('data.speaker', this.data.speaker.toArray()[0]);
}

if (this.isSession && this.get('data.session') && this.get('data.session').length) {
this.set('data.session', this.get('data.session').toArray()[0]);
if (this.isSession && this.data.session && this.data.session.length) {
this.set('data.session', this.data.session.toArray()[0]);
}
}
});
2 changes: 1 addition & 1 deletion app/components/forms/user-profile-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default Component.extend(FormMixin, {
})
.catch(e => {
console.error('Error while updating profile.', e);
this.get('authManager.currentUser').rollbackAttributes();
this.authManager.currentUser.rollbackAttributes();
this.notify.error(this.l10n.t('An unexpected error occurred'), {
id: 'profi_error'
});
Expand Down
Loading