mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
fix: do not show moderator-hidden pastes in the ajax pastes
This commit is contained in:
parent
83f3fdb5e6
commit
490f434f83
3 changed files with 2 additions and 1 deletions
|
@ -10,7 +10,6 @@ class Pastedown extends ParsedownExtra {
|
||||||
$this->BlockTypes['@'] = ['Purpletext'];
|
$this->BlockTypes['@'] = ['Purpletext'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function blockGreentext($Line)
|
protected function blockGreentext($Line)
|
||||||
{
|
{
|
||||||
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
|
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
|
||||||
|
|
|
@ -20,6 +20,7 @@ $pastes = Paste::with([
|
||||||
}
|
}
|
||||||
])->select(['id', 'user_id', 'title', 'expiry'])
|
])->select(['id', 'user_id', 'title', 'expiry'])
|
||||||
->where('visible', Paste::VISIBILITY_PUBLIC)
|
->where('visible', Paste::VISIBILITY_PUBLIC)
|
||||||
|
->where('hidden', false)
|
||||||
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))");
|
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))");
|
||||||
|
|
||||||
if (!empty($_GET['q']) && is_string($_GET['q'])) {
|
if (!empty($_GET['q']) && is_string($_GET['q'])) {
|
||||||
|
|
|
@ -115,6 +115,7 @@ if (isset($_POST['hide'])) {
|
||||||
|
|
||||||
$paste->is_hidden = $is_hidden;
|
$paste->is_hidden = $is_hidden;
|
||||||
$paste->save();
|
$paste->save();
|
||||||
|
$redis->del('ajax_pastes'); /* Expire from Redis so it doesn't show up anymore */
|
||||||
flashSuccess('Paste ' . ($is_hidden ? 'hidden' : 'unhidden') . '.');
|
flashSuccess('Paste ' . ($is_hidden ? 'hidden' : 'unhidden') . '.');
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
die();
|
die();
|
||||||
|
|
Loading…
Add table
Reference in a new issue