mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
Database changes (#19)
* Rename suspend_until column * Missed one! * Update core attribute names * Rename user.suspendUntil
This commit is contained in:
committed by
Franz Liedke
parent
3f37d68314
commit
1b3a432c41
@@ -5,7 +5,7 @@ export default class SuspendUserModal extends Modal {
|
||||
init() {
|
||||
super.init();
|
||||
|
||||
let until = this.props.user.suspendUntil();
|
||||
let until = this.props.user.suspendedUntil();
|
||||
let status = null;
|
||||
|
||||
if (new Date() > until) until = null;
|
||||
@@ -81,21 +81,21 @@ export default class SuspendUserModal extends Modal {
|
||||
|
||||
this.loading = true;
|
||||
|
||||
let suspendUntil = null;
|
||||
let suspendedUntil = null;
|
||||
switch (this.status()) {
|
||||
case 'indefinitely':
|
||||
suspendUntil = new Date('2038-01-01');
|
||||
suspendedUntil = new Date('2038-01-01');
|
||||
break;
|
||||
|
||||
case 'limited':
|
||||
suspendUntil = moment().add(this.daysRemaining(), 'days').toDate();
|
||||
suspendedUntil = moment().add(this.daysRemaining(), 'days').toDate();
|
||||
break;
|
||||
|
||||
default:
|
||||
// no default
|
||||
}
|
||||
|
||||
this.props.user.save({suspendUntil}).then(
|
||||
this.props.user.save({suspendedUntil}).then(
|
||||
() => this.hide(),
|
||||
this.loaded.bind(this)
|
||||
);
|
||||
|
@@ -13,11 +13,11 @@ export default class UserSuspendedNotification extends Notification {
|
||||
|
||||
content() {
|
||||
const notification = this.props.notification;
|
||||
const suspendUntil = notification.content();
|
||||
const timeReadable = moment(suspendUntil.date).from(notification.time(), true);
|
||||
const suspendedUntil = notification.content();
|
||||
const timeReadable = moment(suspendedUntil.date).from(notification.createdAt(), true);
|
||||
|
||||
return app.translator.trans('flarum-suspend.forum.notifications.user_suspended_text', {
|
||||
user: notification.sender(),
|
||||
user: notification.fromUser(),
|
||||
timeReadable,
|
||||
});
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ export default class UserUnsuspendedNotification extends Notification {
|
||||
const notification = this.props.notification;
|
||||
|
||||
return app.translator.trans('flarum-suspend.forum.notifications.user_unsuspended_text', {
|
||||
user: notification.sender(),
|
||||
user: notification.fromUser(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ app.initializers.add('flarum-suspend', () => {
|
||||
app.notificationComponents.userUnsuspended = UserUnsuspendedNotification;
|
||||
|
||||
User.prototype.canSuspend = Model.attribute('canSuspend');
|
||||
User.prototype.suspendUntil = Model.attribute('suspendUntil', Model.transformDate);
|
||||
User.prototype.suspendedUntil = Model.attribute('suspendedUntil', Model.transformDate);
|
||||
|
||||
extend(UserControls, 'moderationControls', (items, user) => {
|
||||
if (user.canSuspend()) {
|
||||
@@ -28,7 +28,7 @@ app.initializers.add('flarum-suspend', () => {
|
||||
});
|
||||
|
||||
extend(User.prototype, 'badges', function(items) {
|
||||
const until = this.suspendUntil();
|
||||
const until = this.suspendedUntil();
|
||||
|
||||
if (new Date() < until) {
|
||||
items.add('suspended', Badge.component({
|
||||
|
Reference in New Issue
Block a user