master
Aevann1 2022-02-18 14:50:59 +02:00
parent 8802c849ca
commit 63bf12dbb2
3 changed files with 21 additions and 17 deletions

View File

@ -269,6 +269,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = g.db.query(Submission)
if sub: posts = posts.filter_by(sub=sub.name)
elif SITE_NAME == 'Drama': posts = posts.filter(Submission.sub == None)
else:
if SITE_NAME == 'Ruqqus':
posts = posts.filter(Submission.sub != None)
@ -347,6 +348,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
if sub: pins = pins.filter_by(sub=sub.name)
elif SITE_NAME == 'Drama': pins = pins.filter(Submission.sub == None)
else:
if SITE_NAME == 'Ruqqus':
pins = pins.filter(Submission.sub != None)

View File

@ -126,7 +126,7 @@ def submit_get(v, sub=None):
if request.path.startswith('/s/') and not sub: abort(404)
SUBS = tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
SUBS = () if SITE_NAME == 'Drama' and not sub else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
return render_template("submit.html", SUBS=SUBS, v=v, sub=sub, ghost=submit_ghost(v,g.db))
@ -854,7 +854,7 @@ def submit_post(v, sub=None):
def error(error):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403
SUBS = tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
SUBS = () if SITE_NAME == 'Drama' and not sub else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body, ghost=submit_ghost(v,g.db)), 400

View File

@ -79,23 +79,25 @@
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<label class='mt-4' for="title">Sub</label>
{% if SITE_NAME != 'Drama' or sub %}
<label class='mt-4' for="title">Sub</label>
<div class="input-group mb2">
<select autocomplete="off" id='sub' class="form-control" form="submitform" name="sub">
{% if SITE_NAME != 'Ruqqus' %}
<option value="none" selected>
None
</option>
{% endif %}
<div class="input-group mb2">
<select autocomplete="off" id='sub' class="form-control" form="submitform" name="sub">
{% if SITE_NAME != 'Ruqqus' %}
<option value="none" selected>
None
</option>
{% endif %}
{% for s in SUBS %}
<option value="{{s}}" {% if sub and sub.name == s %}selected{% endif %}>
/s/{{s}}
</option>
{% endfor %}
</select>
</div>
{% for s in SUBS %}
<option value="{{s}}" {% if sub and sub.name == s %}selected{% endif %}>
/s/{{s}}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<label class='mt-4' for="title">Post Title</label>