fix: exclude passworded pastes from discover and archive

This commit is contained in:
Floorb 2024-07-18 05:24:35 -04:00
parent 24f8a6a9aa
commit 6c0f26f20f
3 changed files with 5 additions and 0 deletions

View file

@ -80,6 +80,7 @@ class Paste extends Model {
->orderBy('updated_at', 'DESC')
->where('visible', self::VISIBILITY_PUBLIC)
->where('is_hidden', false)
->where('password', null)
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))")
->limit($count)->get();
}
@ -89,6 +90,7 @@ class Paste extends Model {
->orderBy('views')
->where('visible', self::VISIBILITY_PUBLIC)
->where('is_hidden', false)
->where('password', null)
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))")
->limit($count)->get();
}
@ -98,6 +100,7 @@ class Paste extends Model {
->whereRaw('MONTH(created_at) = MONTH(NOW())')
->where('visible', self::VISIBILITY_PUBLIC)
->where('is_hidden', false)
->where('password', null)
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))")
->orderBy('views')
->limit($count)->get();

View file

@ -21,6 +21,7 @@ $pastes = Paste::with([
])->select(['id', 'user_id', 'title', 'expiry', 'created_at', 'updated_at'])
->where('visible', Paste::VISIBILITY_PUBLIC)
->where('hidden', false)
->where('password', null)
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))");
// if (!empty($_GET['q']) && is_string($_GET['q'])) {

View file

@ -31,6 +31,7 @@ $pastes = Paste::with([
->select('id', 'user_id', 'title', 'created_at', 'updated_at')
->where('visible', Paste::VISIBILITY_PUBLIC)
->where('hidden', false)
->where('password', null)
->whereRaw("((expiry IS NULL) OR ((expiry != 'SELF') AND (expiry > NOW())))");
if (!empty($filter_value)) {