remotes/1693045480750635534/spooky-22
Aevann1 2022-04-03 19:37:20 +02:00
parent ff55cd1e3b
commit 2cb4d68267
3 changed files with 27 additions and 1 deletions

View File

@ -220,7 +220,7 @@ class User(Base):
@property
@lazy
def paid_dues(self):
return not self.shadowbanned and not (self.is_banned and not self.unban_utc) and (self.admin_level or self.club_allowed or self.patron or (self.club_allowed != False and self.truecoins > dues))
return not self.shadowbanned and not (self.is_banned and not self.unban_utc) and (self.admin_level or self.club_allowed or (self.club_allowed != False and self.truecoins > dues))
@lazy
def any_block_exists(self, other):

View File

@ -42,6 +42,7 @@ def notifications(v):
messages = request.values.get('messages')
modmail = request.values.get('modmail')
posts = request.values.get('posts')
reddit = request.values.get('reddit')
if modmail and v.admin_level > 1:
comments = g.db.query(Comment).filter(Comment.sentto==2).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all()
next_exists = (len(comments) > 25)
@ -68,12 +69,30 @@ def notifications(v):
g.db.commit()
next_exists = (len(notifications) > len(listing))
elif reddit:
notifications = v.notifications.join(Notification.comment).filter(Comment.body_html.like('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all()
listing = []
for index, x in enumerate(notifications[:100]):
c = x.comment
if x.read and index > 24: break
elif not x.read:
x.read = True
c.unread = True
g.db.add(x)
if x.created_utc > 1620391248: c.notif_utc = x.created_utc
listing.append(c)
g.db.commit()
next_exists = (len(notifications) > len(listing))
else:
notifications = v.notifications.join(Notification.comment).filter(
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ID,
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
).order_by(Notification.created_utc.desc()).offset(50 * (page - 1)).limit(51).all()
next_exists = (len(notifications) > 50)

View File

@ -37,6 +37,13 @@
</a>
</li>
{% endif %}
{% if v.admin_level %}
<li class="nav-item">
<a class="nav-link py-3{% if '/notifications?reddit=true' in request.full_path %} active{% endif %}" href="/notifications?reddit=true">
Reddit
</a>
</li>
{% endif %}
</ul>
</div>
</div>