mirror of
https://codeberg.org/tacerus/teddit.git
synced 2025-01-09 04:42:35 +01:00
Do not run a search if there is no query
This commit is contained in:
parent
883f32a817
commit
7e3535b88b
15
routes.js
15
routes.js
@ -719,6 +719,21 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
||||
app.get('/r/:subreddit/search', (req, res, next) => {
|
||||
let subreddit = req.params.subreddit
|
||||
let q = req.query.q
|
||||
|
||||
if (typeof q === "undefined") {
|
||||
return res.render('search', {
|
||||
json: { posts: [] },
|
||||
no_query: true,
|
||||
q: '',
|
||||
restrict_sr: undefined,
|
||||
nsfw: undefined,
|
||||
subreddit: subreddit,
|
||||
sortby: undefined,
|
||||
past: undefined,
|
||||
user_preferences: req.cookies
|
||||
})
|
||||
}
|
||||
|
||||
let restrict_sr = req.query.restrict_sr
|
||||
let nsfw = req.query.nsfw
|
||||
let sortby = req.query.sort
|
||||
|
Loading…
Reference in New Issue
Block a user