From a10b4706955ea22689d20c5f6d8ab56d97bac7e0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Dec 2021 06:58:55 +0200 Subject: [PATCH] fsdfds --- files/classes/user.py | 1 + files/helpers/const.py | 16 ++++++++++++++++ files/routes/awards.py | 23 +++++++++++++++++++++++ files/routes/users.py | 2 +- files/templates/authforms.html | 4 ++-- files/templates/award_modal.html | 7 ++++++- files/templates/default.html | 6 +++--- files/templates/following.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 4 ++-- files/templates/settings2.html | 6 +++--- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 6 +++--- files/templates/user_listing.html | 2 +- files/templates/userpage.html | 4 ++-- 18 files changed, 71 insertions(+), 26 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index d629100b1..c529257dd 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -95,6 +95,7 @@ class User(Base): sig_html = Column(String) fp = Column(String) sigs_disabled = Column(Boolean) + fish = Column(Boolean) friends = deferred(Column(String)) friends_html = deferred(Column(String)) enemies = deferred(Column(String)) diff --git a/files/helpers/const.py b/files/helpers/const.py index 9a69eee7f..957a5c3d6 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -626,6 +626,14 @@ AWARDS = { "color": "text-lightgreen", "price": 10000 }, + "fish": { + "kind": "fish", + "title": "Fish", + "description": "This user cannot be unfollowed", + "icon": "fas fa-fish", + "color": "text-lightblue", + "price": 20000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -774,6 +782,14 @@ AWARDS2 = { "color": "text-lightgreen", "price": 10000 }, + "fish": { + "kind": "fish", + "title": "Fish", + "description": "This user cannot be unfollowed", + "icon": "fas fa-fish", + "color": "text-lightblue", + "price": 20000 + }, "pause": { "kind": "pause", "title": "Pause", diff --git a/files/routes/awards.py b/files/routes/awards.py index 3163bb89d..1a505a2c1 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -183,6 +183,15 @@ def shop(v): "owned": 0, "price": 10000 }, + "fish": { + "kind": "fish", + "title": "Fish", + "description": "This user cannot be unfollowed", + "icon": "fas fa-fish", + "color": "text-lightblue", + "owned": 0, + "price": 20000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -357,6 +366,14 @@ def buy(v, award): "color": "text-lightgreen", "price": 10000 }, + "fish": { + "kind": "fish", + "title": "Fish", + "description": "This user cannot be unfollowed", + "icon": "fas fa-fish", + "color": "text-lightblue", + "price": 20000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -593,6 +610,9 @@ def award_post(pid, v): new_badge = Badge(badge_id=87, user_id=author.id) g.db.add(new_badge) for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block) + elif kind == "fish": + author.fish = True + send_notification(CARP_ID, f"@{v.username} used {kind} award!") if post.author.received_award_count: post.author.received_award_count += 1 else: post.author.received_award_count = 1 @@ -749,6 +769,9 @@ def award_comment(cid, v): new_badge = Badge(badge_id=87, user_id=author.id) g.db.add(new_badge) for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block) + elif kind == "fish": + author.fish = True + send_notification(CARP_ID, f"@{v.username} used {kind} award!") if c.author.received_award_count: c.author.received_award_count += 1 else: c.author.received_award_count = 1 diff --git a/files/routes/users.py b/files/routes/users.py index 16be0d6d4..adc32dca1 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -765,7 +765,7 @@ def unfollow_user(username, v): target = get_user(username) - if target.id == CARP_ID: abort(403) + if target.fish: return {"error": "You can't unfollow this user!"} follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).first() diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 815dac53a..6190c5820 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -13,11 +13,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index d99b8323c..0530af742 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -24,6 +24,11 @@
{{award.owned}} owned
{% endfor %} + + +
 
+
 
+
@@ -73,7 +78,7 @@ @media (min-width: 767.98px) { .award-columns { - column-count: 9 !important; + column-count: 7 !important; } } \ No newline at end of file diff --git a/files/templates/default.html b/files/templates/default.html index 5adb59ba5..711ac3b03 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -4,15 +4,15 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} - + diff --git a/files/templates/following.html b/files/templates/following.html index 43ac5844c..6af7ba03c 100644 --- a/files/templates/following.html +++ b/files/templates/following.html @@ -1,6 +1,6 @@ {% extends "default.html" %} {% block content %} - +
 
 	
@@ -23,7 +23,7 @@
 		{{loop.index}}
 		{{user.username}}
 		{% if v.id == u.id %}
-		
Unfollow
+
Unfollow
{% endif %} {% endfor %} diff --git a/files/templates/log.html b/files/templates/log.html index 65e6a71d4..6cc4a3af2 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,11 +6,11 @@ {% block content %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index e8ee91ee9..ab08d1a39 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -16,7 +16,7 @@ - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 77768331b..64a206f6c 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -12,7 +12,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 1e2049184..d43db4f64 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -31,10 +31,10 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 6fc879a88..25b8b0eff 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -36,13 +36,13 @@ {% if v %} - + {% else %} - + {% endif %} - + diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index e1f242a24..7aa916635 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -28,7 +28,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index ab08fe2e3..c7ec7a889 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -29,7 +29,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 2cbf69642..126ef6d58 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -23,16 +23,16 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} - + diff --git a/files/templates/user_listing.html b/files/templates/user_listing.html index cd53223ac..86bf4c929 100644 --- a/files/templates/user_listing.html +++ b/files/templates/user_listing.html @@ -15,7 +15,7 @@ {% if v.id!=u.id and not u.is_private and not u.is_nofollow %} - {% if u.id != 995 %}{% endif %} + {% if not u.fish %}{% endif %} {% endif %} {% else %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 20c987f0d..2edd70c49 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -157,7 +157,7 @@
{% if v and v.id != u.id %} - {% if u.id != 995 %}Unfollow{% endif %} + {% if not u.fish %}Unfollow{% endif %} Follow Message @@ -441,7 +441,7 @@ {% endif %} {% if v and v.id != u.id %} - {% if u.id != 995 %}Unfollow{% endif %} + {% if not u.fish %}Unfollow{% endif %} Follow Message Get them help