Ghost/ghost/admin/app/components/gh-member-settings-form.js
Nazar Gargol 13d9611b4c Enabled editing email field on member profile page
refs b9db9fa15e

- Now that Admin API allows to edit email, there is no reason to keep this field disabled
2020-02-21 16:12:35 +08:00

44 lines
1.6 KiB
JavaScript

import Component from '@ember/component';
import moment from 'moment';
import {computed} from '@ember/object';
import {gt} from '@ember/object/computed';
import {inject as service} from '@ember/service';
export default Component.extend({
feature: service(),
config: service(),
mediaQueries: service(),
// Allowed actions
setProperty: () => {},
hasMultipleSubscriptions: gt('member.stripe', 1),
subscriptions: computed('member.stripe', function () {
let subscriptions = this.member.get('stripe');
if (subscriptions && subscriptions.length > 0) {
return subscriptions.map((subscription) => {
return {
id: subscription.id,
customer: subscription.customer,
name: subscription.name || '',
email: subscription.email || '',
status: subscription.status,
startDate: subscription.start_date ? moment(subscription.start_date).format('MMM DD YYYY') : '-',
plan: subscription.plan,
dollarAmount: parseInt(subscription.plan.amount) ? (subscription.plan.amount / 100) : 0,
cancelAtPeriodEnd: subscription.cancel_at_period_end,
validUntil: subscription.current_period_end ? moment(subscription.current_period_end).format('MMM DD YYYY') : '-'
};
}).reverse();
}
return null;
}),
actions: {
setProperty(property, value) {
this.setProperty(property, value);
}
}
});