hide christchurch posts in New Zealand

master
Aevann 2023-05-27 02:29:34 +03:00
parent f4f283fb70
commit bec99392fe
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from sqlalchemy.orm import aliased, deferred, Query
from sqlalchemy.sql import case, func, literal from sqlalchemy.sql import case, func, literal
from sqlalchemy.sql.expression import not_, and_, or_ from sqlalchemy.sql.expression import not_, and_, or_
from sqlalchemy.sql.sqltypes import * from sqlalchemy.sql.sqltypes import *
from flask import g, session from flask import g, session, request
from files.classes import Base from files.classes import Base
from files.classes.casino_game import CasinoGame from files.classes.casino_game import CasinoGame
@ -1037,6 +1037,8 @@ class User(Base):
return False return False
if other.sub and not cls.can_see(user, other.subr): if other.sub and not cls.can_see(user, other.subr):
return False return False
if 'christchurch' in other.title.lower() and request.headers.get("Cf-Ipcountry") == 'NZ':
return False
else: else:
if other.parent_submission: if other.parent_submission:
return cls.can_see(user, other.post) return cls.can_see(user, other.post)