From 490f434f83218f1e04369b0cc6712e6ce6bef4c9 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Mon, 15 May 2023 07:28:13 -0400 Subject: [PATCH] fix: do not show moderator-hidden pastes in the ajax pastes --- includes/Pastedown.php | 1 - public/api/ajax_pastes.php | 1 + public/paste.php | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Pastedown.php b/includes/Pastedown.php index a79c778..51766a9 100644 --- a/includes/Pastedown.php +++ b/includes/Pastedown.php @@ -10,7 +10,6 @@ class Pastedown extends ParsedownExtra { $this->BlockTypes['@'] = ['Purpletext']; } - protected function blockGreentext($Line) { if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) diff --git a/public/api/ajax_pastes.php b/public/api/ajax_pastes.php index dd139da..4681790 100644 --- a/public/api/ajax_pastes.php +++ b/public/api/ajax_pastes.php @@ -20,6 +20,7 @@ $pastes = Paste::with([ } ])->select(['id', 'user_id', 'title', 'expiry']) ->where('visible', Paste::VISIBILITY_PUBLIC) + ->where('hidden', false) ->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))"); if (!empty($_GET['q']) && is_string($_GET['q'])) { diff --git a/public/paste.php b/public/paste.php index 5f93592..fc7ac8f 100644 --- a/public/paste.php +++ b/public/paste.php @@ -115,6 +115,7 @@ if (isset($_POST['hide'])) { $paste->is_hidden = $is_hidden; $paste->save(); + $redis->del('ajax_pastes'); /* Expire from Redis so it doesn't show up anymore */ flashSuccess('Paste ' . ($is_hidden ? 'hidden' : 'unhidden') . '.'); header('Location: /'); die();