mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:11:40 +08:00
Database changes (#15)
* Update database references * Use whereColumn * Update core references
This commit is contained in:
parent
959f2b654c
commit
feb940097c
@ -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));
|
||||
});
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class ApproveContent
|
||||
$post = $event->post;
|
||||
$discussion = $post->discussion;
|
||||
|
||||
$discussion->refreshCommentsCount();
|
||||
$discussion->refreshCommentCount();
|
||||
$discussion->refreshLastPost();
|
||||
|
||||
if ($post->number == 1) {
|
||||
|
@ -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();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user