mirror of
https://github.com/flarum/core.git
synced 2025-08-02 22:47:33 +02:00
Database changes (#15)
* Update database references * Use whereColumn * Update core references
This commit is contained in:
committed by
Franz Liedke
parent
959f2b654c
commit
feb940097c
@@ -51,7 +51,7 @@ class DiscussionPolicy extends AbstractPolicy
|
|||||||
|
|
||||||
if (! $actor->hasPermission('discussion.approvePosts')) {
|
if (! $actor->hasPermission('discussion.approvePosts')) {
|
||||||
$query->where(function (Builder $query) use ($actor) {
|
$query->where(function (Builder $query) use ($actor) {
|
||||||
$query->where('start_user_id', $actor->id)
|
$query->where('user_id', $actor->id)
|
||||||
->orWhere($this->canApprovePosts($actor));
|
->orWhere($this->canApprovePosts($actor));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ class ApproveContent
|
|||||||
$post = $event->post;
|
$post = $event->post;
|
||||||
$discussion = $post->discussion;
|
$discussion = $post->discussion;
|
||||||
|
|
||||||
$discussion->refreshCommentsCount();
|
$discussion->refreshCommentCount();
|
||||||
$discussion->refreshLastPost();
|
$discussion->refreshLastPost();
|
||||||
|
|
||||||
if ($post->number == 1) {
|
if ($post->number == 1) {
|
||||||
|
@@ -49,7 +49,7 @@ class UnapproveNewContent
|
|||||||
$post = $event->post;
|
$post = $event->post;
|
||||||
|
|
||||||
if (! $post->exists) {
|
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 ($event->actor->can($ability, $post->discussion)) {
|
||||||
if ($post->is_approved === null) {
|
if ($post->is_approved === null) {
|
||||||
@@ -71,7 +71,7 @@ class UnapproveNewContent
|
|||||||
|
|
||||||
$flag->post_id = $post->id;
|
$flag->post_id = $post->id;
|
||||||
$flag->type = 'approval';
|
$flag->type = 'approval';
|
||||||
$flag->time = time();
|
$flag->created_at = time();
|
||||||
|
|
||||||
$flag->save();
|
$flag->save();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user