forked from rDrama/rDrama
fdfd
parent
d1abc98657
commit
c74565b34b
|
@ -66,15 +66,13 @@ def image_posts_listing(v):
|
||||||
|
|
||||||
page = int(request.args.get('page', 1))
|
page = int(request.args.get('page', 1))
|
||||||
|
|
||||||
posts = g.db.query(Submission).filter_by(domain_ref=1).order_by(Submission.id.desc()
|
posts = g.db.query(Submission).order_by(Submission.id.desc())
|
||||||
).offset(25 * (page - 1)
|
|
||||||
).limit(26)
|
|
||||||
|
|
||||||
posts = [x.id for x in posts]
|
firstrange = 25 * (page - 1)
|
||||||
|
secondrange = firstrange+26
|
||||||
|
posts = [x.id for x in posts if x.is_image][firstrange:secondrange]
|
||||||
next_exists = (len(posts) == 26)
|
next_exists = (len(posts) == 26)
|
||||||
posts = posts[:25]
|
posts = get_posts(posts[:25], v=v)
|
||||||
|
|
||||||
posts = get_posts(posts, v=v)
|
|
||||||
|
|
||||||
return render_template("admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new")
|
return render_template("admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new")
|
||||||
|
|
||||||
|
|
|
@ -773,7 +773,6 @@ def submit_post(v):
|
||||||
new_post = Submission(
|
new_post = Submission(
|
||||||
private=bool(request.form.get("private","")),
|
private=bool(request.form.get("private","")),
|
||||||
author_id=v.id,
|
author_id=v.id,
|
||||||
domain_ref=domain_obj.id if domain_obj else None,
|
|
||||||
over_18=bool(request.form.get("over_18","")),
|
over_18=bool(request.form.get("over_18","")),
|
||||||
app_id=v.client.application.id if v.client else None,
|
app_id=v.client.application.id if v.client else None,
|
||||||
is_bot = request.headers.get("X-User-Type","").lower()=="bot"
|
is_bot = request.headers.get("X-User-Type","").lower()=="bot"
|
||||||
|
@ -826,7 +825,6 @@ def submit_post(v):
|
||||||
|
|
||||||
|
|
||||||
new_post.url = upload_file(file)
|
new_post.url = upload_file(file)
|
||||||
new_post.domain_ref = 1 # id of i.ruqqus.ga domain
|
|
||||||
g.db.add(new_post)
|
g.db.add(new_post)
|
||||||
g.db.add(new_post.submission_aux)
|
g.db.add(new_post.submission_aux)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
Loading…
Reference in New Issue