mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
57b1ab4800
no issue - part of ember upgrades - removed all unnecessary usage of `.get` - cleaned up imports where we had imports from the same module across multiple lines - standardized on importing specific computed helpers rather than using `computed.foo` - switched tests from using `wait()` to `settled()`
39 lines
1020 B
JavaScript
39 lines
1020 B
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
|
|
import {alias} from '@ember/object/computed';
|
|
import {inject as service} from '@ember/service';
|
|
import {task, timeout} from 'ember-concurrency';
|
|
|
|
export default ModalComponent.extend({
|
|
config: service(),
|
|
store: service(),
|
|
|
|
classNames: 'modal-impersonate-member',
|
|
|
|
signinUrl: null,
|
|
member: alias('model'),
|
|
|
|
didInsertElement() {
|
|
this._super(...arguments);
|
|
|
|
this._signinUrlUpdateTask.perform();
|
|
},
|
|
|
|
actions: {
|
|
// noop - we don't want the enter key doing anything
|
|
confirm() {}
|
|
},
|
|
|
|
copySigninUrl: task(function* () {
|
|
copyTextToClipboard(this.signinUrl);
|
|
yield timeout(1000);
|
|
return true;
|
|
}),
|
|
|
|
_signinUrlUpdateTask: task(function*() {
|
|
const memberSigninURL = yield this.member.fetchSigninUrl.perform();
|
|
|
|
this.set('signinUrl', memberSigninURL.url);
|
|
}).drop()
|
|
});
|