From ebcc561c03fe73c239378da009b56bc434d4e57f Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 17 Oct 2023 21:54:02 +0300 Subject: [PATCH] titlecolor -> flaircolor --- files/classes/user.py | 2 +- files/routes/settings.py | 6 +++--- files/templates/comments.html | 4 ++-- files/templates/settings/personal.html | 2 +- files/templates/userpage/banner.html | 8 ++++---- files/templates/util/macros.html | 4 ++-- migrations/20231017-rename-titlecolor-to-flaircolor.sql | 1 + schema.sql | 3 +-- seed-users.sql | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 migrations/20231017-rename-titlecolor-to-flaircolor.sql diff --git a/files/classes/user.py b/files/classes/user.py index 33344730c..c05a582e2 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -58,7 +58,7 @@ class User(Base): profile_background = Column(String) flair = deferred(Column(String)) flair_html = Column(String) - titlecolor = Column(String, default=DEFAULT_COLOR) + flaircolor = Column(String, default=DEFAULT_COLOR) theme = Column(String, default=DEFAULT_THEME) themecolor = Column(String, default=DEFAULT_COLOR) song = Column(String) diff --git a/files/routes/settings.py b/files/routes/settings.py index 97f92c6b8..34ac238cf 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -426,14 +426,14 @@ def namecolor(v): def themecolor(v): return set_color(v, "themecolor") -@app.post("/settings/titlecolor") +@app.post("/settings/flaircolor") @limiter.limit('1/second', scope=rpath) @limiter.limit('1/second', scope=rpath, key_func=get_ID) @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @auth_required -def titlecolor(v): - return set_color(v, "titlecolor") +def flaircolor(v): + return set_color(v, "flaircolor") @app.post("/settings/verifiedcolor") @limiter.limit('1/second', scope=rpath) diff --git a/files/templates/comments.html b/files/templates/comments.html index fc4be51e8..95077cf97 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -176,10 +176,10 @@ {{c.author_name}} {% if FEATURES['PRONOUNS'] %} - {{c.author.pronouns_display}} + {{c.author.pronouns_display}} {% endif %} {% if c.author.flair_html %} -   {{c.author.flair_html | safe}} +   {{c.author.flair_html | safe}} {% endif %} {% endif %} diff --git a/files/templates/settings/personal.html b/files/templates/settings/personal.html index e60ba0fe6..d9443d49d 100644 --- a/files/templates/settings/personal.html +++ b/files/templates/settings/personal.html @@ -209,7 +209,7 @@ {{common.line_text_section('flair', '/settings/change_flair', 'flair', 'Flair', v.flair, 'Limit of 100 characters', 'Enter a flair here', 'Change Flair', true, 0, 100, '.*', v.flairchanged)}} - {{common.color_section('flaircolor', '/settings/titlecolor', 'titlecolor', 'Flair Color', v.titlecolor)}} + {{common.color_section('flaircolor', '/settings/flaircolor', 'flaircolor', 'Flair Color', v.flaircolor)}} {% if FEATURES['USERS_PROFILE_SONG'] -%}
diff --git a/files/templates/userpage/banner.html b/files/templates/userpage/banner.html index e9257b4bf..484c86b63 100644 --- a/files/templates/userpage/banner.html +++ b/files/templates/userpage/banner.html @@ -64,11 +64,11 @@
{% if FEATURES['PRONOUNS'] and can_see(v, u) %} -

{{u.pronouns_display}}

+

{{u.pronouns_display}}

{% endif %} {% if u.flair_html and can_see(v, u) %} -

{{u.flair_html | safe}}

+

{{u.flair_html | safe}}

{% endif %}
@@ -359,11 +359,11 @@ {% endif %} {% if FEATURES['PRONOUNS'] and can_see(v, u) %} -

{{u.pronouns_display}}

+

{{u.pronouns_display}}

{% endif %} {% if u.flair_html and can_see(v, u) %} -

{{u.flair_html | safe}}

+

{{u.flair_html | safe}}

{% endif %}
diff --git a/files/templates/util/macros.html b/files/templates/util/macros.html index 3f279dfdf..f44c0369e 100644 --- a/files/templates/util/macros.html +++ b/files/templates/util/macros.html @@ -88,10 +88,10 @@ {{p.author_name}} {% if FEATURES['PRONOUNS'] %} - {{p.author.pronouns_display}} + {{p.author.pronouns_display}} {% endif %} {% if p.author.flair_html %} - {{p.author.flair_html | safe}} + {{p.author.flair_html | safe}} {% endif %} {% endif %}  {{p.age_string}} diff --git a/migrations/20231017-rename-titlecolor-to-flaircolor.sql b/migrations/20231017-rename-titlecolor-to-flaircolor.sql new file mode 100644 index 000000000..e9ccc03ae --- /dev/null +++ b/migrations/20231017-rename-titlecolor-to-flaircolor.sql @@ -0,0 +1 @@ +alter table users rename column titlecolor to flaircolor; diff --git a/schema.sql b/schema.sql index 827a17088..9324fc8fd 100644 --- a/schema.sql +++ b/schema.sql @@ -98,7 +98,7 @@ CREATE TABLE public.users ( defaultsorting character varying(15) NOT NULL, defaulttime character varying(5) NOT NULL, namecolor character varying(6) NOT NULL, - titlecolor character varying(6) NOT NULL, + flaircolor character varying(6) NOT NULL, profileurl character varying(65), bannerurl character varying(65), newtab boolean DEFAULT false NOT NULL, @@ -3047,4 +3047,3 @@ ALTER TABLE ONLY public.comments -- -- PostgreSQL database dump complete -- - diff --git a/seed-users.sql b/seed-users.sql index 6e9cf68e1..c78b4073d 100644 --- a/seed-users.sql +++ b/seed-users.sql @@ -1,6 +1,6 @@ INSERT INTO public.users ( username, passhash, created_utc, admin_level, email_verified, - original_username, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor, theme, themecolor, + original_username, defaultsorting, defaultsortingcomments, defaulttime, namecolor, flaircolor, theme, themecolor, reddit, pronouns, verified, profileurl, highres, marsify, last_viewed_post_notifs, last_viewed_log_notifs, last_viewed_reddit_notifs, lifetimedonated, lifetimedonated_visible, show_sigs ) VALUES