diff --git a/files/classes/user.py b/files/classes/user.py index 8f79af3af..cacee67c6 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -394,7 +394,7 @@ class User(Base): @property @lazy - def all_blocks(self): + def sub_blocks(self): stealth = set([x[0] for x in g.db.query(Sub.name).filter_by(stealth=True).all()]) stealth = stealth - set([x[0] for x in g.db.query(SubJoin.sub).filter_by(user_id=self.id).all()]) if self.chud == 1: stealth = stealth - {'chudrama'} diff --git a/files/routes/front.py b/files/routes/front.py index 45a6aea0b..77d42ddaa 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -92,7 +92,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' if sub: posts = posts.filter(Post.sub == sub.name) elif v: - posts = posts.filter(or_(Post.sub == None, Post.sub.notin_(v.all_blocks))) + posts = posts.filter(or_(Post.sub == None, Post.sub.notin_(v.sub_blocks))) else: stealth = [x[0] for x in g.db.query(Sub.name).filter_by(stealth=True).all()] posts = posts.filter(or_(Post.sub == None, Post.sub.notin_(stealth))) @@ -148,7 +148,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' pins = g.db.query(Post).options(load_only(Post.id)).filter(Post.stickied != None, Post.is_banned == False) if v: - pins = pins.filter(or_(Post.sub == None, Post.sub.notin_(v.all_blocks))) + pins = pins.filter(or_(Post.sub == None, Post.sub.notin_(v.sub_blocks))) for pin in pins: if pin.stickied_utc and int(time.time()) > pin.stickied_utc: pin.stickied = None diff --git a/files/templates/sub/subs.html b/files/templates/sub/subs.html index e9ca8dc7c..8ebd590c4 100644 --- a/files/templates/sub/subs.html +++ b/files/templates/sub/subs.html @@ -18,7 +18,7 @@ {% for sub, count in subs %} {{loop.index}} - {{sub}} {% if sub.name in v.all_blocks %}[blocked, visit it to unblock it]{% endif %} + {{sub}} {% if sub.name in v.sub_blocks %}[blocked, visit it to unblock it]{% endif %} {{count}} {{sub.follow_num}} {% if sub.stealth %}