Propic clarification and option to lock propic editing

This commit is contained in:
Ed 2023-01-19 17:03:38 +01:00
parent 6d247462bd
commit 5d00cdd7f4
3 changed files with 13 additions and 3 deletions

4
ext.py
View File

@ -60,6 +60,7 @@ class Order:
self.is_artist = True if self.ans('is_artist') != 'No' else False
self.is_fursuiter = True if self.ans('is_fursuiter') != 'No' else False
self.is_allergic = True if self.ans('is_allergic') != 'No' else False
self.propic_locked = self.ans('propic_locked')
self.birth_date = self.ans('birth_date')
self.name = self.ans('fursona_name')
self.room_id = self.ans('room_id')
@ -120,6 +121,7 @@ class Order:
async with httpx.AsyncClient() as client:
res = await client.patch(join(base_url, f'orderpositions/{self.position_id}/'), headers=headers, json={'answers': self.answers})
self.pending_update = False
self.time = -1
@dataclass
class Quotas:
@ -183,7 +185,7 @@ class OrderManager:
self.add_cache(Order(o))
# If a cached order is needed, just get it if available
if code and cached and code in self.cache and time()-self.cache[code].time < 1800:
if code and cached and code in self.cache and time()-self.cache[code].time < 3600:
return self.cache[code]
# If it's a request, ignore all the other parameters and just get the order of the requestor

View File

@ -15,6 +15,9 @@ bp = Blueprint("propic", url_prefix="/manage/propic")
async def upload_propic(request, order: Order):
if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
if order.propic_locked:
raise exceptions.BadRequest("You have been limited from further editing the propic.")
if request.form.get('submit') == 'Delete main image':
await order.edit_answer('propic', None)

View File

@ -2,9 +2,11 @@
<summary role="button"><img src="/res/icons/badge.svg" class="icon"/>Badge Customization {% if not order.ans('propic') %}<span class="status">⚠️</span>{% endif %}</summary>
{# Badge is always shown #}
<h2>Badge</h2>
{% if order.propic_locked %}
<p class="notice">⚠️ You have been limited from further editing your profile pic.</p>
{% endif %}
{% if (not order.ans('propic')) or (order.ans('is_fursuiter') != 'No' and not order.ans('propic_fursuiter')) %}
<p class="notice">⚠️ One or more badge pictures are missing! This will cause you badge to be empty, so make sure to upload something before the deadline!</p>
<p class="notice">⚠️ Photos must be suitable for any audience. Any inappropriate picture will be removed by the staff</p>
{% endif %}
<form method="POST" enctype="multipart/form-data" action="/manage/propic/upload">
<div class="grid" style="text-align:center;margin-bottom:1em;">
@ -31,7 +33,10 @@
</div>
{% endif %}
</div>
<p><em>Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png</em></p>
<p><em>
Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png<br />
Badge photos must clearly show the fursona/fursuit head.<br />Memes and low quality images will be removed and may limit your ability to upload pics in the future.
</em></p>
<div class="grid">
{% if order.ans('propic') %}
<input type="submit" name="submit" value="Delete main image" />