add button to remove current profile background
parent
84ec5f5b46
commit
15088e5eef
|
@ -89,9 +89,19 @@ def upload_profile_background(v):
|
||||||
os.remove(v.profile_background)
|
os.remove(v.profile_background)
|
||||||
v.profile_background = background
|
v.profile_background = background
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
badge_grant(badge_id=193, user=v)
|
# badge_grant(badge_id=193, user=v)
|
||||||
return redirect(f'/@{v.username}')
|
return redirect(f'/@{v.username}')
|
||||||
|
|
||||||
|
@app.delete('/settings/profile_background')
|
||||||
|
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||||
|
@auth_required
|
||||||
|
@ratelimit_user()
|
||||||
|
def delete_profile_background(v):
|
||||||
|
if v.profile_background:
|
||||||
|
os.remove(v.profile_background)
|
||||||
|
v.profile_background = None
|
||||||
|
return {"message": "Profile background removed!"}
|
||||||
|
|
||||||
@app.post("/settings/personal")
|
@app.post("/settings/personal")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -210,6 +210,15 @@
|
||||||
</label>
|
</label>
|
||||||
<input autocomplete="off" id="upload-profile-background-file" accept="image/*", type="file" name="file" onchange="this.form.submit()" hidden>
|
<input autocomplete="off" id="upload-profile-background-file" accept="image/*", type="file" name="file" onchange="this.form.submit()" hidden>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{% if v.profile_background -%}
|
||||||
|
<div class="d-flex mb-3">
|
||||||
|
<button type="button" class="btn btn-danger" onclick="postToastReload(this,'/settings/profile_background', 'DELETE')">
|
||||||
|
<i class="fas fa-image-slash mr-1"></i>
|
||||||
|
Remove current background
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{%- endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
{% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
|
||||||
|
@ -428,6 +437,15 @@
|
||||||
</label>
|
</label>
|
||||||
<input autocomplete="off" id="upload-profile-background-file-mobile" accept="image/*", type="file" name="file" onchange="this.form.submit()" hidden>
|
<input autocomplete="off" id="upload-profile-background-file-mobile" accept="image/*", type="file" name="file" onchange="this.form.submit()" hidden>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{% if v.profile_background -%}
|
||||||
|
<div class="d-block mt-3 mb-3">
|
||||||
|
<button type="button" class="btn btn-danger" onclick="postToastReload(this,'/settings/profile_background', 'DELETE')">
|
||||||
|
<i class="fas fa-image-slash mr-1"></i>
|
||||||
|
Remove current background
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue