diff --git a/files/routes/search.py b/files/routes/search.py index c64e61848..aaa5ba96b 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -111,8 +111,13 @@ def searchposts(v): ) for x in criteria['q']] posts = posts.filter(*words) - if 'nsfw' in criteria: posts = posts.filter(Post.nsfw==True) - if 'effortpost' in criteria: posts = posts.filter(Post.effortpost==True) + if 'nsfw' in criteria: + nsfw = criteria['nsfw'].lower().strip() == 'true' + posts = posts.filter_by(nsfw=nsfw) + + if 'effortpost' in criteria: + effortpost = criteria['effortpost'].lower().strip() == 'true' + posts = posts.filter_by(effortpost=effortpost) if 'domain' in criteria: domain = criteria['domain'] diff --git a/files/templates/search.html b/files/templates/search.html index 7fecd9f42..b2de641e0 100644 --- a/files/templates/search.html +++ b/files/templates/search.html @@ -86,13 +86,13 @@ {% endif %} {% if FEATURES['NSFW_MARKING'] %}
-
NSFW Only:
+
NSFW:
{% endif %} {% if request.path.startswith('/search/posts') %}
-
Effortposts Only:
+
Effortpost:
{% endif %}