forked from rDrama/rDrama
1
0
Fork 0

allow carp to send ppl a comment when approving hats or emojis

master
Aevann 2023-10-02 06:40:30 +03:00
parent b99d4ae05d
commit a161765aaa
5 changed files with 31 additions and 7 deletions

View File

@ -1,6 +1,7 @@
function approve_emoji(t, name) {
postToast(t, `/admin/approve/emoji/${name}`,
{
"comment": document.getElementById(`${name}-comment`).value,
"tags": document.getElementById(`${name}-tags`).value,
"name": document.getElementById(`${name}-name`).value,
"kind": document.getElementById(`${name}-kind`).value,
@ -15,7 +16,7 @@ function approve_emoji(t, name) {
function remove_emoji(t, name) {
postToast(t, `/remove/emoji/${name}`,
{
"reason": document.getElementById(`${name}-reason`).value,
"comment": document.getElementById(`${name}-comment`).value,
},
() => {
document.getElementById(`${name}-emoji`).remove()

View File

@ -2,6 +2,7 @@ function approve_hat(t) {
const name = t.dataset.name
postToast(t, `/admin/approve/hat/${name}`,
{
"comment": document.getElementById(`${name}-comment`).value,
"description": document.getElementById(`${name}-description`).value,
"name": document.getElementById(`${name}-name`).value,
"price": document.getElementById(`${name}-price`).value,
@ -16,7 +17,7 @@ function remove_hat(t) {
const name = t.dataset.name
postToast(t, `/remove/hat/${name}`,
{
"reason": document.getElementById(`${name}-reason`).value,
"comment": document.getElementById(`${name}-comment`).value,
},
() => {
document.getElementById(`${name}-hat`).remove()

View File

@ -206,10 +206,20 @@ def approve_emoji(v, name):
if v.id != author.id:
msg = f"@{v.username} (a site admin) has approved an emoji you made: :{emoji.name}:\n\nYou have received 250 coins as a reward!"
comment = request.values.get("comment")
if comment:
msg += f"\nComment: `{comment}`"
send_repeatable_notification(author.id, msg)
if v.id != emoji.submitter_id and author.id != emoji.submitter_id:
msg = f"@{v.username} (a site admin) has approved an emoji you submitted: :{emoji.name}:"
comment = request.values.get("comment")
if comment:
msg += f"\nComment: `{comment}`"
send_repeatable_notification(emoji.submitter_id, msg)
emoji.submitter_id = None
@ -245,10 +255,12 @@ def remove_asset(cls, type_name, v, name):
name = asset.name
if v.id != asset.submitter_id:
reason = request.values.get("reason")
msg = f"@{v.username} has rejected a {type_name} you submitted: `'{name}'`"
if reason:
msg += f"\nReason: `{reason}`"
comment = request.values.get("comment")
if comment:
msg += f"\nComment: `{comment}`"
send_repeatable_notification(asset.submitter_id, msg)
ma = ModAction(
@ -383,10 +395,20 @@ def approve_hat(v, name):
if v.id != author.id:
msg = f"@{v.username} (a site admin) has approved a hat you made: '{hat.name}'"
comment = request.values.get("comment")
if comment:
msg += f"\nComment: `{comment}`"
send_repeatable_notification(author.id, msg)
if v.id != hat.submitter_id and author.id != hat.submitter_id:
msg = f"@{v.username} (a site admin) has approved a hat you submitted: '{hat.name}'"
comment = request.values.get("comment")
if comment:
msg += f"\nComment: `{comment}`"
send_repeatable_notification(hat.submitter_id, msg)
hat.submitter_id = None

View File

@ -109,7 +109,7 @@
</div>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] or v.id == emoji.submitter_id %}
<div class="d-flex my-4 mx-3">
<input autocomplete="off" type="text" id="{{emoji.name}}-reason" class="form-control mr-4" name="reason" placeholder="Rejection reason..." maxlength="500" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}hidden{% endif %}>
<input autocomplete="off" type="text" id="{{emoji.name}}-comment" class="form-control mr-4" name="comment" placeholder="Comment..." maxlength="500" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}hidden{% endif %}>
<button type="button" class="btn btn-danger ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_emoji(this, '{{emoji.name}}')">Remove</button>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}

View File

@ -82,7 +82,7 @@
</div>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] or v.id == hat.submitter_id %}
<div class="d-flex my-4 mx-3">
<input autocomplete="off" type="text" id="{{hat.name}}-reason" class="form-control mr-4" name="reason" placeholder="Rejection reason..." maxlength="500" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}hidden{% endif %}>
<input autocomplete="off" type="text" id="{{hat.name}}-comment" class="form-control mr-4" name="comment" placeholder="Comment..." maxlength="500" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}hidden{% endif %}>
<button type="button" class="btn btn-danger ml-auto" data-nonce="{{g.nonce}}" data-onclick="remove_hat(this)" data-name="{{hat.name}}">Remove</button>
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}