mirror of
https://github.com/flarum/core.git
synced 2025-05-08 00:15:24 +02:00
Allow admins to set a time when creating a post via the API
Again, the use-case for this is to allow the API to be used to import data from an old forum.
This commit is contained in:
parent
248de34242
commit
3767ee4bf6
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
namespace Flarum\Core\Command;
|
namespace Flarum\Core\Command;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Flarum\Core\Access\AssertPermissionTrait;
|
use Flarum\Core\Access\AssertPermissionTrait;
|
||||||
use Flarum\Core\Validator\PostValidator;
|
use Flarum\Core\Validator\PostValidator;
|
||||||
use Flarum\Event\PostWillBeSaved;
|
use Flarum\Event\PostWillBeSaved;
|
||||||
@ -85,6 +86,10 @@ class PostReplyHandler
|
|||||||
$command->ipAddress
|
$command->ipAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($actor->isAdmin() && ($time = array_get($command->data, 'attributes.time'))) {
|
||||||
|
$post->time = new DateTime($time);
|
||||||
|
}
|
||||||
|
|
||||||
$this->events->fire(
|
$this->events->fire(
|
||||||
new PostWillBeSaved($post, $actor, $command->data)
|
new PostWillBeSaved($post, $actor, $command->data)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user