mirror of
https://github.com/flarum/core.git
synced 2025-08-01 14:10:37 +02:00
suspend anonymously (#39)
* suspend anonymously closes https://github.com/flarum/core/issues/2614 * format less file * empty methods should return null
This commit is contained in:
@@ -15,7 +15,6 @@ export default class UserSuspendedNotification extends Notification {
|
|||||||
const timeReadable = dayjs(suspendedUntil).from(notification.createdAt(), true);
|
const timeReadable = dayjs(suspendedUntil).from(notification.createdAt(), true);
|
||||||
|
|
||||||
return app.translator.trans('flarum-suspend.forum.notifications.user_suspended_text', {
|
return app.translator.trans('flarum-suspend.forum.notifications.user_suspended_text', {
|
||||||
user: notification.fromUser(),
|
|
||||||
timeReadable,
|
timeReadable,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,6 @@ export default class UserUnsuspendedNotification extends Notification {
|
|||||||
content() {
|
content() {
|
||||||
const notification = this.attrs.notification;
|
const notification = this.attrs.notification;
|
||||||
|
|
||||||
return app.translator.trans('flarum-suspend.forum.notifications.user_unsuspended_text', {
|
return app.translator.trans('flarum-suspend.forum.notifications.user_unsuspended_text');
|
||||||
user: notification.fromUser(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,3 +10,9 @@
|
|||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.Notification--userSuspended,
|
||||||
|
.Notification--userUnsuspended {
|
||||||
|
> .Avatar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -15,8 +15,8 @@ flarum-suspend:
|
|||||||
forum:
|
forum:
|
||||||
# These translations are used in the suspension notifications
|
# These translations are used in the suspension notifications
|
||||||
notifications:
|
notifications:
|
||||||
user_suspended_text: "{username} suspended you for {timeReadable}"
|
user_suspended_text: "You have been suspended for {timeReadable}"
|
||||||
user_unsuspended_text: "{username} unsuspended you"
|
user_unsuspended_text: You have been unsuspended
|
||||||
|
|
||||||
# These translations are used in the Suspend User modal dialog (admin function).
|
# These translations are used in the Suspend User modal dialog (admin function).
|
||||||
suspend_user:
|
suspend_user:
|
||||||
|
@@ -31,7 +31,7 @@ class SendNotificationWhenUserIsSuspended
|
|||||||
public function handle(Suspended $event)
|
public function handle(Suspended $event)
|
||||||
{
|
{
|
||||||
$this->notifications->sync(
|
$this->notifications->sync(
|
||||||
new UserSuspendedBlueprint($event->user, $event->actor),
|
new UserSuspendedBlueprint($event->user),
|
||||||
[$event->user]
|
[$event->user]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ class SendNotificationWhenUserIsUnsuspended
|
|||||||
public function handle(Unsuspended $event)
|
public function handle(Unsuspended $event)
|
||||||
{
|
{
|
||||||
$this->notifications->sync(
|
$this->notifications->sync(
|
||||||
new UserUnsuspendedBlueprint($event->user, $event->actor),
|
new UserUnsuspendedBlueprint($event->user),
|
||||||
[$event->user]
|
[$event->user]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -19,19 +19,12 @@ class UserSuspendedBlueprint implements BlueprintInterface
|
|||||||
*/
|
*/
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var User
|
|
||||||
*/
|
|
||||||
public $actor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param User $actor
|
|
||||||
*/
|
*/
|
||||||
public function __construct(User $user, User $actor)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->actor = $actor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +40,7 @@ class UserSuspendedBlueprint implements BlueprintInterface
|
|||||||
*/
|
*/
|
||||||
public function getFromUser()
|
public function getFromUser()
|
||||||
{
|
{
|
||||||
return $this->actor;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -19,19 +19,12 @@ class UserUnsuspendedBlueprint implements BlueprintInterface
|
|||||||
*/
|
*/
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var User
|
|
||||||
*/
|
|
||||||
public $actor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param User $actor
|
|
||||||
*/
|
*/
|
||||||
public function __construct(User $user, User $actor)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->actor = $actor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +40,7 @@ class UserUnsuspendedBlueprint implements BlueprintInterface
|
|||||||
*/
|
*/
|
||||||
public function getFromUser()
|
public function getFromUser()
|
||||||
{
|
{
|
||||||
return $this->actor;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +48,7 @@ class UserUnsuspendedBlueprint implements BlueprintInterface
|
|||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user