fsd
This commit is contained in:
parent
face6eb80a
commit
3a592df14b
3 changed files with 27 additions and 1 deletions
|
@ -220,7 +220,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def paid_dues(self):
|
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
|
@lazy
|
||||||
def any_block_exists(self, other):
|
def any_block_exists(self, other):
|
||||||
|
|
|
@ -42,6 +42,7 @@ def notifications(v):
|
||||||
messages = request.values.get('messages')
|
messages = request.values.get('messages')
|
||||||
modmail = request.values.get('modmail')
|
modmail = request.values.get('modmail')
|
||||||
posts = request.values.get('posts')
|
posts = request.values.get('posts')
|
||||||
|
reddit = request.values.get('reddit')
|
||||||
if modmail and v.admin_level > 1:
|
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()
|
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)
|
next_exists = (len(comments) > 25)
|
||||||
|
@ -68,12 +69,30 @@ def notifications(v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
next_exists = (len(notifications) > len(listing))
|
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:
|
else:
|
||||||
notifications = v.notifications.join(Notification.comment).filter(
|
notifications = v.notifications.join(Notification.comment).filter(
|
||||||
Comment.is_banned == False,
|
Comment.is_banned == False,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id != AUTOJANNY_ID,
|
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()
|
).order_by(Notification.created_utc.desc()).offset(50 * (page - 1)).limit(51).all()
|
||||||
|
|
||||||
next_exists = (len(notifications) > 50)
|
next_exists = (len(notifications) > 50)
|
||||||
|
|
|
@ -37,6 +37,13 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% 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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue