1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

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
This commit is contained in:
Nazar Gargol 2020-02-21 16:12:35 +08:00
parent f1307c3c8e
commit 0cb787d11a
3 changed files with 6 additions and 14 deletions

View file

@ -1,7 +1,7 @@
import Component from '@ember/component';
import moment from 'moment';
import {computed} from '@ember/object';
import {gt, reads} from '@ember/object/computed';
import {gt} from '@ember/object/computed';
import {inject as service} from '@ember/service';
export default Component.extend({
@ -12,8 +12,6 @@ export default Component.extend({
// Allowed actions
setProperty: () => {},
canEditEmail: reads('member.isNew'),
hasMultipleSubscriptions: gt('member.stripe', 1),
subscriptions: computed('member.stripe', function () {

View file

@ -10,14 +10,10 @@
<GhFormGroup @errors={{this.member.errors}} @hasValidated={{this.member.hasValidated}} @property="email" @classNames="max-width">
<label for="member-email">Email</label>
{{#if this.canEditEmail}}
<GhTextInput @value={{this.scratchMember.email}} @id="member-email" @name="email" @tabindex="2"
@autocapitalize="off" @autocorrect="off" @autocomplete="off"
@focus-out={{action "setProperty" "email" this.scratchMember.email}} />
<GhErrorMessage @errors={{this.member.errors}} @property="email" />
{{else}}
<GhTextInput @name="email-disabled" @disabled={{true}} @value={{this.scratchMember.email}} />
{{/if}}
</GhFormGroup>
</div>
<div class="pa5 pt5 pb6 bt b--whitegrey">

View file

@ -89,8 +89,8 @@ describe('Acceptance: Members', function () {
expect(find('.gh-member-settings-primary input[name="name"]').value, 'loads correct member into form')
.to.equal(member1.name);
expect(find('.gh-member-settings-primary input[name="email-disabled"]').disabled, 'makes sure email is disabled')
.to.equal(true);
expect(find('.gh-member-settings-primary input[name="email"]').value, 'loads correct email into form')
.to.equal(member1.email);
// trigger save
await fillIn('.gh-member-settings-primary input[name="name"]', 'New Name');
@ -143,9 +143,6 @@ describe('Acceptance: Members', function () {
.to.be.empty;
});
expect(find('.gh-member-settings-primary input[name="email"]').disabled, 'makes sure email is disabled')
.to.equal(false);
// save new member
await fillIn('.gh-member-settings-primary input[name="name"]', 'New Name');
await blur('.gh-member-settings-primary input[name="name"]');
@ -159,8 +156,9 @@ describe('Acceptance: Members', function () {
expect(find('.gh-member-settings-primary input[name="name"]').value, 'name has been preserved')
.to.equal('New Name');
expect(find('.gh-member-settings-primary input[name="email-disabled"]').disabled, 'makes sure email is disabled')
.to.equal(true);
expect(find('.gh-member-settings-primary input[name="email"]').value, 'email has been preserved')
.to.equal('example@domain.com');
});
});
});