From 317bea3f843017f2e03461ed8a61568c528005ac Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 15 Feb 2024 15:55:04 +0200 Subject: [PATCH] more hiding for logged-out --- files/helpers/can_see.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/files/helpers/can_see.py b/files/helpers/can_see.py index 8a69839c6..29cf52b72 100644 --- a/files/helpers/can_see.py +++ b/files/helpers/can_see.py @@ -4,9 +4,18 @@ from files.classes.comment import Comment from files.classes.hole import Hole from flask import request +words_to_hide = ('israel', 'palestin', 'muslim', 'islam', 'hamas', 'jew', 'gaza', 'rafah', 'isis', 'terror', 'iraq') + def can_see(user, other): if isinstance(other, (Post, Comment)): - if not user and other.nsfw: return False + if not user: + if other.nsfw: + return False + if any((x in other.body.lower() for x in words_to_hide)): + return False + if isinstance(other, Post) and other.hole == 'sandshit': + return False + if not can_see(user, other.author): return False if user and user.id == other.author_id: return True if isinstance(other, Post):