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

feat: deprecate discussion post_number_index field.

This commit is contained in:
Alexander Skvortsov
2022-03-30 15:51:21 -04:00
committed by Daniël Klabbers
parent e25c53c00f
commit 00b9151864
3 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class UnapproveNewContent
$post = $event->post; $post = $event->post;
if (! $post->exists) { if (! $post->exists) {
$ability = $post->discussion->post_number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval'; $ability = $post->discussion->first_post_id === null ? '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) {

View File

@ -30,7 +30,7 @@ use Illuminate\Support\Str;
* @property string $slug * @property string $slug
* @property int $comment_count * @property int $comment_count
* @property int $participant_count * @property int $participant_count
* @property int $post_number_index * @property int $post_number_index !!DEPRECATED!!
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property int|null $user_id * @property int|null $user_id
* @property int|null $first_post_id * @property int|null $first_post_id

View File

@ -74,7 +74,7 @@ class PostReplyHandler
// If this is the first post in the discussion, it's technically not a // If this is the first post in the discussion, it's technically not a
// "reply", so we won't check for that permission. // "reply", so we won't check for that permission.
if ($discussion->post_number_index > 0) { if ($discussion->first_post_id !== null) {
$actor->assertCan('reply', $discussion); $actor->assertCan('reply', $discussion);
} }