forked from MarseyWorld/MarseyWorld
fsd
parent
a3313b403d
commit
30833f8130
|
@ -433,7 +433,7 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def reddit_notifications_count(self):
|
||||
return g.db.query(Notification.user_id).join(Comment).filter(Notification.user_id == self.id, Notification.read == False, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.body_html.like('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')).count()
|
||||
return g.db.query(Notification.user_id).join(Comment).filter(Notification.user_id == self.id, Notification.read == False, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.body_html.like('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -71,7 +71,7 @@ def notifications(v):
|
|||
|
||||
next_exists = (len(notifications) > len(listing))
|
||||
elif reddit:
|
||||
notifications = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(Notification.user_id == v.id, 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()
|
||||
notifications = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(Notification.user_id == v.id, Comment.body_html.like('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all()
|
||||
|
||||
listing = []
|
||||
|
||||
|
@ -92,7 +92,7 @@ def notifications(v):
|
|||
comments = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(
|
||||
Notification.user_id == v.id,
|
||||
Comment.author_id != AUTOJANNY_ID,
|
||||
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
||||
Comment.body_html.notlike('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')
|
||||
).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(100).all()
|
||||
|
||||
for n, c in comments:
|
||||
|
@ -109,7 +109,7 @@ def notifications(v):
|
|||
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/%')
|
||||
Comment.body_html.notlike('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')
|
||||
).order_by(Comment.top_comment_id.desc(), Notification.created_utc.desc()).subquery()
|
||||
|
||||
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(sq.c.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()
|
||||
|
@ -122,7 +122,7 @@ def notifications(v):
|
|||
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/%')
|
||||
Comment.body_html.notlike('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')
|
||||
).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(500).all()]
|
||||
|
||||
comms = get_comments(cids, v=v)
|
||||
|
|
|
@ -718,7 +718,7 @@ def thumbnail_thread(pid):
|
|||
|
||||
if i["subreddit"] == 'PokemonGoRaids': continue
|
||||
|
||||
body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
body_html = sanitize(f'New site mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, body_html=body_html).one_or_none()
|
||||
if existing_comment: break
|
||||
|
@ -775,7 +775,7 @@ def thumbnail_thread(pid):
|
|||
except: break
|
||||
|
||||
for i in data:
|
||||
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
body_html = sanitize(f'New site mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
|
||||
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, body_html=body_html).one_or_none()
|
||||
|
||||
|
|
Loading…
Reference in New Issue