fix: do not show moderator-hidden pastes in the ajax pastes

This commit is contained in:
Floorb 2023-05-15 07:28:13 -04:00
parent 83f3fdb5e6
commit 490f434f83
3 changed files with 2 additions and 1 deletions

View file

@ -10,7 +10,6 @@ class Pastedown extends ParsedownExtra {
$this->BlockTypes['@'] = ['Purpletext'];
}
protected function blockGreentext($Line)
{
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))

View file

@ -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'])) {

View file

@ -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();