rusbrain / reps2_beta1

кузы2
http://reps2.ru
GNU General Public License v3.0
11 stars 5 forks source link

Incorrect news pagination #179

Closed ghost closed 5 years ago

ghost commented 5 years ago

News pagination don't match an actual number of accessible pages

Highly likely caused by app/ForumTopic.php with a lack of "approved" validation

    public static function getLastForums ()
    {
        return ForumTopic::new_forums()->where('news', 1)->with([
            'user' => function ($q) {
                $q->withTrashed()->with('avatar');
            }
        ])
        ->withCount('positive', 'negative', 'comments')
        ->with('preview_image', 'icon');
    }
    public static function new_forums()
    {
        return ForumTopic::where(function ($q) {
            $q->whereNull('start_on')
                ->orWhere('start_on', '<=', Carbon::now()->format('Y-m-d'));
        })

        ->whereHas('section', function ($q) {
            $q->where('is_active', 1);
        })->orderBy('created_at', 'desc');
    }

1 2

ghost commented 5 years ago

The problem appears to be a misconception in tag handling

resources/views/home
{!! 
$general_helper->closeAllTags(
$general_helper->oldContentFilter(
str_replace($preview_content_text, $preview_content, $single_news->preview_content) ??
str_replace($full_content_text, $full_content, $single_news->content).' ...')
)
!!}
----------------------------------------------------------------------------------
/app/Services/GeneralViewHelper.php
 public function closeAllTags

List of improperly parsed news caught At this moment 6996 is the last id http://dpaste.com/3SJ4E8S

widedeveloper commented 5 years ago

I fixed this last_news loading bug.