1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 18:26:07 +02:00

fixed more attributes to match beta 8

This commit is contained in:
Daniel Klabbers
2018-05-14 13:49:52 +02:00
parent a9501ceae0
commit 3e3e1cbde5
22 changed files with 65 additions and 45 deletions

View File

@@ -11,7 +11,7 @@
namespace Flarum\Post\Command;
use DateTime;
use Carbon\Carbon;
use Flarum\Discussion\DiscussionRepository;
use Flarum\Foundation\DispatchEventsTrait;
use Flarum\Notification\NotificationSyncer;
@@ -77,7 +77,7 @@ class PostReplyHandler
// If this is the first post in the discussion, it's technically not a
// "reply", so we won't check for that permission.
if ($discussion->number_index > 0) {
if ($discussion->post_number_index > 0) {
$this->assertCan($actor, 'reply', $discussion);
}
@@ -92,7 +92,7 @@ class PostReplyHandler
);
if ($actor->isAdmin() && ($time = array_get($command->data, 'attributes.time'))) {
$post->time = new DateTime($time);
$post->created_at = new Carbon($time);
}
$this->events->dispatch(

View File

@@ -11,6 +11,7 @@
namespace Flarum\Post;
use Carbon\Carbon;
use Flarum\Formatter\Formatter;
use Flarum\Post\Event\Hidden;
use Flarum\Post\Event\Posted;
@@ -51,7 +52,7 @@ class CommentPost extends Post
{
$post = new static;
$post->created_at = time();
$post->created_at = Carbon::now();
$post->discussion_id = $discussionId;
$post->user_id = $userId;
$post->type = static::$type;
@@ -77,7 +78,7 @@ class CommentPost extends Post
if ($this->content !== $content) {
$this->content = $content;
$this->edited_at = time();
$this->edited_at = Carbon::now();
$this->edited_user_id = $actor->id;
$this->raise(new Revised($this));
@@ -95,7 +96,7 @@ class CommentPost extends Post
public function hide(User $actor = null)
{
if (! $this->hidden_at) {
$this->hidden_at = time();
$this->hidden_at = Carbon::now();
$this->hidden_user_id = $actor ? $actor->id : null;
$this->raise(new Hidden($this));

View File

@@ -11,6 +11,8 @@
namespace Flarum\Post;
use Carbon\Carbon;
/**
* A post which indicates that a discussion's title was changed.
*
@@ -64,7 +66,7 @@ class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterf
$post = new static;
$post->content = static::buildContent($oldTitle, $newTitle);
$post->time = time();
$post->created_at = Carbon::now();
$post->discussion_id = $discussionId;
$post->user_id = $userId;