forked from MarseyWorld/MarseyWorld
marsey submission stuff
parent
e0d4a03934
commit
fbbb2c2ceb
|
@ -12,7 +12,7 @@ marseyaward_body_regex = re.compile(">[^<\s+]|[^>\s+]<", flags=re.A)
|
|||
|
||||
marseyaward_title_regex = re.compile("( *<img[^>]+>)+", flags=re.A)
|
||||
|
||||
marsey_regex = re.compile("[a-z0-9]{1,30}", flags=re.A)
|
||||
marsey_regex = re.compile("marsey[a-z0-9]{1,24}", flags=re.A)
|
||||
|
||||
hat_regex = re.compile("[a-zA-Z0-9\-() ,_]{1,50}", flags=re.A)
|
||||
|
||||
|
|
|
@ -492,13 +492,16 @@ def submit_marsey(v):
|
|||
@app.post("/admin/approve/marsey/<name>")
|
||||
@admin_level_required(3)
|
||||
def approve_marsey(v, name):
|
||||
if CARP_ID and v.id != CARP_ID: abort(403)
|
||||
if CARP_ID and v.id != CARP_ID:
|
||||
return {"error": "Only Carp can approve marseys!"}
|
||||
|
||||
marsey = g.db.query(Marsey).filter_by(name=name).one_or_none()
|
||||
if not marsey: abort(404)
|
||||
if not marsey:
|
||||
return {"error": f"This marsey `{name}` doesn't exist!"}
|
||||
|
||||
tags = request.values.get('tags')
|
||||
if not tags: abort(400)
|
||||
if not tags:
|
||||
return {"error": "You need to include tags!"}
|
||||
|
||||
marsey.tags = tags
|
||||
g.db.add(marsey)
|
||||
|
@ -528,10 +531,12 @@ def approve_marsey(v, name):
|
|||
@app.post("/admin/reject/marsey/<name>")
|
||||
@admin_level_required(3)
|
||||
def reject_marsey(v, name):
|
||||
if CARP_ID and v.id != CARP_ID: abort(403)
|
||||
if CARP_ID and v.id != CARP_ID:
|
||||
return {"error": "Only Carp can approve marseys!"}
|
||||
|
||||
marsey = g.db.query(Marsey).filter_by(name=name).one_or_none()
|
||||
if not marsey: abort(404)
|
||||
if not marsey:
|
||||
return {"error": f"This marsey `{name}` doesn't exist!"}
|
||||
|
||||
msg = f'@{v.username} has rejected a marsey you submitted: `{marsey.name}`'
|
||||
send_repeatable_notification(marsey.submitter_id, msg)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</div>
|
||||
|
||||
<label class="mt-3" for="name">Name</label>
|
||||
<input autocomplete="off" type="text" id="name" class="form-control" name="name" maxlength="30" pattern='[a-z0-9]{1,30}' required>
|
||||
<input autocomplete="off" type="text" id="name" class="form-control" name="name" maxlength="30" pattern='marsey[a-z0-9]{1,24}' required>
|
||||
|
||||
<label class="mt-3" for="author">Author</label>
|
||||
<input autocomplete="off" type="text" id="author" class="form-control" name="author" value="{{v.username.lower()}}" maxlength="30" pattern='[a-z0-9_\-]{3,30}' required>
|
||||
|
@ -118,7 +118,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<h2 class="mt-5 mx-4">Current Applications</h2>
|
||||
<h2 class="mt-5 mx-4">Pending Carp Approval</h2>
|
||||
<div class="row mt-5 mx-4">
|
||||
<div class="col px-0">
|
||||
<div class="settings">
|
||||
|
|
Loading…
Reference in New Issue