From 1d49012c16137e3ba5a6de716377ab94ceec04e3 Mon Sep 17 00:00:00 2001 From: TLSM Date: Wed, 1 Jun 2022 00:05:14 -0400 Subject: [PATCH] Revise 16587cdf7cf5, expand assetcache. Assetcache: now supports js/userpage.js & js/userpage_v.js. The three userpage*.html templates now implement it. Revising gift messages 16587cdf7cf5: - routes/users.py: Deduplicate code, more descriptive var name. - templates/userpage.html: Move post-tax gift line below reasons box. Ultimately just an aesthetic change. --- files/routes/users.py | 14 ++++++++------ files/templates/userpage.html | 12 ++++++------ files/templates/userpage_comments.html | 4 ++-- files/templates/userpage_private.html | 4 ++-- files/templates/util/assetcache.html | 2 ++ 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 67f99a04b..5487167ed 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -418,10 +418,11 @@ def transfer_coins(v, username): receiver.coins += amount-tax v.coins -= amount - if reason: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!\n\n> {reason}" - else: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!" + notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!" + if reason: + notif_text += f"\n\n> {reason}" - send_repeatable_notification(receiver.id, text) + send_repeatable_notification(receiver.id, notif_text) g.db.add(receiver) g.db.add(v) @@ -457,10 +458,11 @@ def transfer_bux(v, username): receiver.procoins += amount v.procoins -= amount - if reason: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!\n\n> {reason}" - else: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!" + notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!" + if reason: + notif_text += f"\n\n> {reason}" - send_repeatable_notification(receiver.id, text) + send_repeatable_notification(receiver.id, notif_text) g.db.add(receiver) g.db.add(v) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 020dda3ef..6cc89de65 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -214,15 +214,15 @@
-
{{u.username}} will receive 0 coins
+
{{u.username}} will receive 0 coins
-
{{u.username}} will receive 0 marseybux
+
{{u.username}} will receive 0 marseybux
@@ -524,15 +524,15 @@
-
{{u.username}} will receive 0 coins
+
{{u.username}} will receive 0 coins
-
{{u.username}} will receive 0 marseybux
+
{{u.username}} will receive 0 marseybux
@@ -741,11 +741,11 @@ {% if v %}
{% if v.patron or u.patron or v.alts_patron or u.alts_patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} diff --git a/files/templates/userpage_comments.html b/files/templates/userpage_comments.html index ea466c1c9..521299ee3 100644 --- a/files/templates/userpage_comments.html +++ b/files/templates/userpage_comments.html @@ -114,9 +114,9 @@ {% if v %}
{% if v.patron or u.patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html index 9a98521d8..28d7b45d3 100644 --- a/files/templates/userpage_private.html +++ b/files/templates/userpage_private.html @@ -32,9 +32,9 @@ {% if v %}
{% if v.patron or u.patron %}0{% else %}0.03{% endif %}
- +
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 3ad24c85c..f6f6d1da6 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -19,6 +19,8 @@ set CACHE_VER = { 'js/bootstrap.js': 258, 'js/header.js': 269, 'js/lottery.js': 253, + 'js/userpage.js': 241, + 'js/userpage_v.js': 245, 'images/badges/': 1020, }