dfdf
parent
4fd28db30c
commit
2023bfc7fc
|
@ -365,50 +365,6 @@ class User(Base, Stndrd, Age_times):
|
|||
secondrange = firstrange + 26
|
||||
return comments[firstrange:secondrange]
|
||||
|
||||
|
||||
def notification_subscriptions(self, page=1):
|
||||
|
||||
notifications = self.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT)
|
||||
|
||||
notifications = notifications.options(
|
||||
contains_eager(Notification.comment)
|
||||
)
|
||||
|
||||
notifications = notifications.order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26)
|
||||
|
||||
output = []
|
||||
for x in notifications:
|
||||
x.read = True
|
||||
g.db.add(x)
|
||||
output.append(x.comment_id)
|
||||
|
||||
return output
|
||||
|
||||
def notification_commentlisting(self, page=1):
|
||||
|
||||
notifications = self.notifications.join(Notification.comment).filter(
|
||||
Comment.is_banned == False,
|
||||
Comment.deleted_utc == 0,
|
||||
Comment.author_id != AUTOJANNY_ACCOUNT,
|
||||
)
|
||||
|
||||
if not all_:
|
||||
notifications = notifications.filter(Notification.read == False)
|
||||
|
||||
notifications = notifications.options(
|
||||
contains_eager(Notification.comment)
|
||||
)
|
||||
|
||||
notifications = notifications.order_by(
|
||||
Notification.id.desc()).offset(25 * (page - 1)).limit(26)
|
||||
|
||||
output = []
|
||||
for x in notifications:
|
||||
x.read = True
|
||||
g.db.add(x)
|
||||
output.append(x.comment_id)
|
||||
return output
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def notifications_count(self):
|
||||
|
|
|
@ -26,15 +26,33 @@ def notifications(v):
|
|||
cids = cids[:25]
|
||||
comments = get_comments(cids, v=v)
|
||||
elif posts:
|
||||
cids = v.notification_subscriptions(page=page)
|
||||
next_exists = (len(cids) == 26)
|
||||
cids = cids[:25]
|
||||
comments = get_comments(cids, v=v)
|
||||
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26)
|
||||
|
||||
comments = []
|
||||
for x in notifications:
|
||||
c = x.comment
|
||||
if not x.read: c.unread = True
|
||||
x.read = True
|
||||
g.db.add(x)
|
||||
comments.append(c)
|
||||
next_exists = (len(comments) == 26)
|
||||
comments = comments[:25]
|
||||
else:
|
||||
cids = v.notification_commentlisting(page=page)
|
||||
next_exists = (len(cids) == 26)
|
||||
cids = cids[:25]
|
||||
comments = get_comments(cids, v=v, load_parent=True)
|
||||
notifications = v.notifications.join(Notification.comment).filter(
|
||||
Comment.is_banned == False,
|
||||
Comment.deleted_utc == 0,
|
||||
Comment.author_id != AUTOJANNY_ACCOUNT,
|
||||
).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26)
|
||||
|
||||
comments = []
|
||||
for x in notifications:
|
||||
c = x.comment
|
||||
if not x.read: c.unread = True
|
||||
x.read = True
|
||||
g.db.add(x)
|
||||
comments.append(c)
|
||||
next_exists = (len(comments) == 26)
|
||||
comments = comments[:25]
|
||||
|
||||
listing = []
|
||||
for c in comments:
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="comment-{{c.id}}" class="comment {% if standalone and level==1 %} mt-0{% endif %}{% if c.collapse_for_user(v) or (standalone and c.over_18 and not (v and v.over_18)) %} collapsed{% endif %}" style="border-left: 2px solid #{{c.author.namecolor}};">
|
||||
<div id="comment-{{c.id}}" class="comment {% if standalone and level==1 %} mt-0{% endif %}{% if c.collapse_for_user(v) or (standalone and c.over_18 and not (v and v.over_18)) %} collapsed{% endif %}" style="border-left: 2px solid #{{c.author.namecolor}};{% if c.unread %}padding: 10px; border: 2px solid $primary;{% endif %}">
|
||||
|
||||
<span class="comment-collapse-desktop d-none d-md-block" style="border-left: 2px solid #{{c.author.namecolor}};" onclick="collapse_comment('{{c.id}}')"></span>
|
||||
|
||||
|
|
Loading…
Reference in New Issue