Rename user.isActivated

This commit is contained in:
Toby Zerner 2018-08-24 21:35:04 +09:30
parent d9d8162684
commit 70058652b5
8 changed files with 12 additions and 12 deletions

View File

@ -12,7 +12,7 @@ Object.assign(User.prototype, {
username: Model.attribute('username'),
displayName: Model.attribute('displayName'),
email: Model.attribute('email'),
isActivated: Model.attribute('isActivated'),
isEmailConfirmed: Model.attribute('isEmailConfirmed'),
password: Model.attribute('password'),
avatarUrl: Model.attribute('avatarUrl'),

View File

@ -15,7 +15,7 @@ export default class EditUserModal extends Modal {
this.username = m.prop(user.username() || '');
this.email = m.prop(user.email() || '');
this.isActivated = m.prop(user.isActivated() || false);
this.isEmailConfirmed = m.prop(user.isEmailConfirmed() || false);
this.setPassword = m.prop(false);
this.password = m.prop(user.password() || '');
this.groups = {};
@ -50,7 +50,7 @@ export default class EditUserModal extends Modal {
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
bidi={this.email} />
</div>
{!this.isActivated() ? (
{!this.isEmailConfirmed() ? (
<div>
{Button.component({
className: 'Button Button--block',
@ -115,11 +115,11 @@ export default class EditUserModal extends Modal {
this.loading = true;
const data = {
username: this.username(),
isActivated: true,
isEmailConfirmed: true,
};
this.props.user.save(data, {errorHandler: this.onerror.bind(this)})
.then(() => {
this.isActivated(true);
this.isEmailConfirmed(true);
this.loading = false;
m.redraw();
})

View File

@ -10,7 +10,7 @@ import icon from '../../common/helpers/icon';
export default function alertEmailConfirmation(app) {
const user = app.session.user;
if (!user || user.isActivated()) return;
if (!user || user.isEmailConfirmed()) return;
const resendButton = Button.component({
className: 'Button Button--link',

View File

@ -22,7 +22,7 @@ class CurrentUserSerializer extends UserSerializer
$attributes = parent::getDefaultAttributes($user);
$attributes += [
'isActivated' => (bool) $user->is_email_confirmed,
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'readTime' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),

View File

@ -56,8 +56,8 @@ class UserSerializer extends BasicUserSerializer
if ($canEdit || $this->actor->id === $user->id) {
$attributes += [
'isActivated' => (bool) $user->is_email_confirmed,
'email' => $user->email
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email
];
}

View File

@ -103,7 +103,7 @@ class EditUserHandler
}
}
if ($actor->isAdmin() && ! empty($attributes['isActivated'])) {
if ($actor->isAdmin() && ! empty($attributes['isEmailConfirmed'])) {
$user->activate();
}

View File

@ -112,7 +112,7 @@ class RegisterUserHandler
}
}
if ($actor->isAdmin() && array_get($data, 'attributes.isActivated')) {
if ($actor->isAdmin() && array_get($data, 'attributes.isEmailConfirmed')) {
$user->activate();
}

View File

@ -66,7 +66,7 @@ class CreateUserControllerTest extends ApiControllerTestCase
$this->actor = $this->getAdminUser();
$response = $this->callWith(array_merge($this->data, [
'isActivated' => 1
'isEmailConfirmed' => 1
]));
$this->assertEquals(201, $response->getStatusCode());