fix listing bugs

master
justcool393 2022-11-15 03:28:39 -06:00
parent 8f2f48d6d1
commit 4b9c702877
5 changed files with 8 additions and 9 deletions

View File

@ -80,7 +80,6 @@ class Comment(Base):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Comment(id={self.id})>" return f"<Comment(id={self.id})>"
@lazy @lazy

View File

@ -53,7 +53,7 @@ def notifications_modmail(v):
g.db.commit() g.db.commit()
if v.client: return {"data":[x.json for x in listing]} if v.client: return {"data":[x.json(g.db) for x in listing]}
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,
@ -123,7 +123,7 @@ def notifications_messages(v):
c.unread = True c.unread = True
list_to_perserve_unread_attribute.append(c) list_to_perserve_unread_attribute.append(c)
if v.client: return {"data":[x.json for x in listing]} if v.client: return {"data":[x.json(g.db) for x in listing]}
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,
@ -165,7 +165,7 @@ def notifications_posts(v):
v.last_viewed_post_notifs = int(time.time()) v.last_viewed_post_notifs = int(time.time())
g.db.add(v) g.db.add(v)
if v.client: return {"data":[x.json for x in listing]} if v.client: return {"data":[x.json(g.db) for x in listing]}
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,
@ -247,7 +247,7 @@ def notifications_reddit(v):
g.db.commit() g.db.commit()
if v.client: return {"data":[x.json for x in listing]} if v.client: return {"data":[x.json(g.db) for x in listing]}
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,
@ -318,7 +318,7 @@ def notifications(v):
g.db.commit() g.db.commit()
if v.client: return {"data":[x.json for x in listing]} if v.client: return {"data":[x.json(g.db) for x in listing]}
return render_template("notifications.html", return render_template("notifications.html",
v=v, v=v,

View File

@ -166,7 +166,7 @@ def searchposts(v):
posts = get_posts(ids, v=v, eager=True) posts = get_posts(ids, v=v, eager=True)
if v.client: return {"total":total, "data":[x.json for x in posts]} if v.client: return {"total":total, "data":[x.json(g.db) for x in posts]}
return render_template("search.html", return render_template("search.html",
v=v, v=v,

View File

@ -400,7 +400,7 @@ def transfers(v):
comments = comments[:PAGE_SIZE] comments = comments[:PAGE_SIZE]
if v.client: if v.client:
return {"data": [x.json for x in comments]} return {"data": [x.json(g.db) for x in comments]}
else: else:
return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists) return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists)

View File

@ -956,7 +956,7 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone
listing = get_comments(ids, v=v) listing = get_comments(ids, v=v)
else: else:
raise TypeError("Only supports Submissions and Comments. This is probably the result of a bug with *this* function") raise TypeError("Only supports Submissions and Comments. This is probably the result of a bug with *this* function")
if v.client: return {"data": [x.json for x in listing]} if v.client: return {"data": [x.json(g.db) for x in listing]}
return render_template(template, u=v, v=v, listing=listing, page=page, next_exists=next_exists, standalone=standalone) return render_template(template, u=v, v=v, listing=listing, page=page, next_exists=next_exists, standalone=standalone)
@app.get("/@<username>/saved/posts") @app.get("/@<username>/saved/posts")