Database changes (#15)

* Update database references

* Use whereColumn

* Update core references
This commit is contained in:
Toby Zerner 2018-09-17 04:19:28 +09:30 committed by Franz Liedke
parent 959f2b654c
commit feb940097c
3 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ class DiscussionPolicy extends AbstractPolicy
if (! $actor->hasPermission('discussion.approvePosts')) {
$query->where(function (Builder $query) use ($actor) {
$query->where('start_user_id', $actor->id)
$query->where('user_id', $actor->id)
->orWhere($this->canApprovePosts($actor));
});
}

View File

@ -60,7 +60,7 @@ class ApproveContent
$post = $event->post;
$discussion = $post->discussion;
$discussion->refreshCommentsCount();
$discussion->refreshCommentCount();
$discussion->refreshLastPost();
if ($post->number == 1) {

View File

@ -49,7 +49,7 @@ class UnapproveNewContent
$post = $event->post;
if (! $post->exists) {
$ability = $post->discussion->number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval';
$ability = $post->discussion->post_number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval';
if ($event->actor->can($ability, $post->discussion)) {
if ($post->is_approved === null) {
@ -71,7 +71,7 @@ class UnapproveNewContent
$flag->post_id = $post->id;
$flag->type = 'approval';
$flag->time = time();
$flag->created_at = time();
$flag->save();
});