remove mass-deleting (why was it added?)
parent
4f57533d2c
commit
5bc3c06700
|
@ -602,32 +602,6 @@ def delete_hole_sidebar(v, hole):
|
|||
|
||||
return {"message": "Sidebar image deleted successfully!"}
|
||||
|
||||
@app.post("/h/<hole>/settings/sidebars/delete_all")
|
||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def delete_all_hole_sidebars(v, hole):
|
||||
hole = get_hole(hole)
|
||||
if not v.mods_hole(hole.name): abort(403)
|
||||
|
||||
for sidebar in hole.sidebarurls:
|
||||
try:
|
||||
remove_media_using_link(sidebar)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
hole.sidebarurls = []
|
||||
g.db.add(hole)
|
||||
|
||||
ma = HoleAction(
|
||||
hole=hole.name,
|
||||
kind='delete_sidebar_image',
|
||||
_note='all',
|
||||
user_id=v.id
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
return {"message": f"Deleted all sidebar images from /h/{hole} successfully"}
|
||||
|
||||
@app.post("/h/<hole>/settings/banners")
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
|
@ -693,32 +667,6 @@ def delete_hole_banner(v, hole):
|
|||
|
||||
return {"message": "Banner deleted successfully!"}
|
||||
|
||||
@app.post("/h/<hole>/settings/banners/delete_all")
|
||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit("1/10 second;30/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def delete_all_hole_banners(v, hole):
|
||||
hole = get_hole(hole)
|
||||
if not v.mods_hole(hole.name): abort(403)
|
||||
|
||||
for banner in hole.bannerurls:
|
||||
try:
|
||||
remove_media_using_link(banner)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
hole.bannerurls = []
|
||||
g.db.add(hole)
|
||||
|
||||
ma = HoleAction(
|
||||
hole=hole.name,
|
||||
kind='delete_banner',
|
||||
_note='all',
|
||||
user_id=v.id
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
return {"message": f"Deleted all banners from /h/{hole} successfully"}
|
||||
|
||||
@app.post("/h/<hole>/marsey_image")
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
<label class="btn btn-secondary text-capitalize mr-2 mb-0">
|
||||
Upload New Banner<input id="upload_banner" autocomplete="off" type="file" accept="image/*" hidden name="banner" data-nonce="{{g.nonce}}" data-onchange="upload_banner(this, '{{hole.name}}')">
|
||||
</label>
|
||||
<button type="button" class="btn btn-danger hole-banner-delete-button" id="hole-banner-delete-all" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{hole.name}}/settings/banners/delete_all')">Delete All Banners</button>
|
||||
<div class="text-small text-muted mt-3">
|
||||
All image files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.
|
||||
</div>
|
||||
|
@ -131,7 +130,6 @@
|
|||
<label class="btn btn-secondary text-capitalize mr-2 mb-0">
|
||||
Upload New Sidebar Image<input id="upload_sidebar" autocomplete="off" type="file" accept="image/*" hidden name="sidebar" data-nonce="{{g.nonce}}" data-onchange="upload_sidebar(this, '{{hole.name}}')">
|
||||
</label>
|
||||
<button type="button" class="btn btn-danger hole-sidebar-delete-button" id="hole-sidebar-delete-all" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/h/{{hole.name}}/settings/sidebars/delete_all')">Delete All Sidebar Images</button>
|
||||
<div class="text-small text-muted mt-3">
|
||||
All image files are supported. Max file size is {% if v and v.patron %}16{% else %}8{% endif %} MB.
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue