tell ppl who receive the chud award the phrase they'll have to say

pull/142/head
Aevann 2023-03-21 17:27:46 +02:00
parent f14b759849
commit 34744fb741
3 changed files with 15 additions and 18 deletions

View File

@ -122,9 +122,11 @@ function pick(kind, price, coins, marseybux) {
if (kind == "agendaposter") {
document.getElementById('phrase_section').classList.remove("d-none")
document.getElementById('note_section').classList.add("d-none")
}
else {
document.getElementById('phrase_section').classList.add("d-none")
document.getElementById('note_section').classList.remove("d-none")
}
if (kind == "flairlock") {
@ -171,16 +173,13 @@ function buy(mb) {
function giveaward(t) {
const kind = document.getElementById('kind').value;
const values = {
"kind": kind,
"note": document.getElementById('note').value
}
if (kind == "agendaposter")
values["agendaposter_phrase"] = document.getElementById('agendaposter_phrase').value
const note_id = (kind == "agendaposter" ? "agendaposter_phrase" : "note")
postToast(t, t.dataset.action,
values,
{
"kind": kind,
"note": document.getElementById(note_id).value
},
() => {
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent) - 1;

View File

@ -300,21 +300,17 @@ def award_thing(v, thing_type, id):
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!")
if author.agendaposter == 1:
abort(409, f"{safe_username} is perma-chudded!")
abort(409, f"{safe_username} is already chudded permanently!")
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
else: author.agendaposter = int(time.time()) + 86400
agendaposter_phrase = request.values.get("agendaposter_phrase").lower()
if not agendaposter_phrase: abort(400, "Missing phrase!")
if not note: abort(400, "Missing phrase!")
agendaposter_phrase = agendaposter_phrase.strip()
if not agendaposter_phrase: abort(400, "Missing phrase!")
if len(agendaposter_phrase) > 50:
if len(note) > 50:
abort(400, "Max length for phrase is 50 characters!")
author.agendaposter_phrase = agendaposter_phrase
author.agendaposter_phrase = note
badge_grant(user=author, badge_id=28)
elif kind == "flairlock":

View File

@ -54,8 +54,10 @@
</div>
</div>
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
<div id="note_section">
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
</div>
<input autocomplete="off" id="giveaward" class="awardbtn btn btn-primary mt-3 fl-r" type="submit" data-nonce="{{g.nonce}}" data-onclick="giveaward(this)" value="Give Award" data-bs-dismiss="modal" disabled>