From f9e96fbebefe18ce37f4481cf787fe4d39ceb537 Mon Sep 17 00:00:00 2001 From: TheVillageGuy <47496248+TheVillageGuy@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:50:25 +0100 Subject: [PATCH 01/37] Make a default avatar with static background color based on username --- templates/components/user_avatar.html.twig | 34 +++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/templates/components/user_avatar.html.twig b/templates/components/user_avatar.html.twig index 78621c9e7..9d7ac5ff8 100644 --- a/templates/components/user_avatar.html.twig +++ b/templates/components/user_avatar.html.twig @@ -10,10 +10,36 @@ style="max-width: {{ width }}px; max-height: {{ height }}px;" src="{{ user.avatar.filePath ? (asset(user.avatar.filePath)|imagine_filter('avatar_thumb')) : user.avatar.sourceUrl }}" alt="{{ user.username ~' '~ 'avatar'|trans|lower }}"> - {% else %} -
+ {% else %} + {% set hexDigits = {'a': '2', 'b': '7', 'c': '0', 'd': '8', 'e': '4', 'f': '1', 'g': '3', 'h': '5', 'i': '6', 'j': '9', 'k': 'a', + 'l': 'b', 'm': 'c', 'n': 'd', 'o': 'e', 'p': 'f', 'q': '0', 'r': '1', 's': '2', 't': '3', 'u': '4', 'v': '5', 'w': '6', 'x': '7', 'y': '8', 'z': '9', + '_': 'a', '-': 'b', '0': 'e', '1': 'a', '2': 'f', '3': 'b', '4': 'c', '5': '9', '6': '3', '7': '5', '8': '6', '9': 'd', + 'A': '4', 'B': '8', 'C': '1', 'D': '7', 'E': '2', 'F': '5', 'G': '9', 'H': '0', 'I': '3', 'J': '6', 'K': 'b', 'L': 'e', 'M': 'a', 'N': 'f', 'O': 'c', + 'P': 'd', 'Q': '2', 'R': '4', 'S': '7', 'T': '1', 'U': '8', 'V': '5', 'W': '0', 'X': '3', 'Y': '6', 'Z': '9'} %} + {% set validChars = '' %} + {% for char in user.username|split('') %} + {% if char in hexDigits|keys %} + {% set validChars = validChars ~ hexDigits[char] %} + {% endif %} + {% endfor %} + {% set validChars = validChars ~ "012345" %} + {% set rgbChars = validChars|slice(0, 6) %} + {% set color = '#' ~ rgbChars %} + {% if app.user is defined and app.user is not same as null and app.user is same as user %} + {% set noAvatar = "you can set your avatar in your profile" %} + {% else %} + {% set noAvatar = user.username ~ " has no avatar" %} + {% endif %} +NoLi
zT!!A+XGIKgah~CW*c?Ob*hi$qWn?MqUwrTg{6!37mTv&A@Ll%dh3wQ*f52co*7 NoLi
zT!!A+XGIKgah~CW*c?Ob*hi$qWn?MqUwrTg{6!37mTv&A@Ll%dh3wQ*f52co*7 NoLi
zT!!A+XGIKgah~CW*c?Ob*hi$qWn?MqUwrTg{6!37mTv&A@Ll%dh3wQ*f52co*7
From e5579c81ba34c89543450f87bb50110b994be478 Mon Sep 17 00:00:00 2001
From: TheVillageGuy <47496248+TheVillageGuy@users.noreply.github.com>
Date: Thu, 13 Mar 2025 17:08:55 +0100
Subject: [PATCH 06/37] Update user_inline.html.twig
---
templates/components/user_inline.html.twig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/templates/components/user_inline.html.twig b/templates/components/user_inline.html.twig
index 542b22f70..9664dbc63 100644
--- a/templates/components/user_inline.html.twig
+++ b/templates/components/user_inline.html.twig
@@ -29,11 +29,10 @@
{% else %}
{% set noAvatar = user.username ~ " has no avatar" %}
{% endif %}
- {# todo: set the actual server and create a default avatar #}
From 143015f70bc3f1f0466ed0b3179e39969c39f1ee Mon Sep 17 00:00:00 2001
From: TheVillageGuy <47496248+TheVillageGuy@users.noreply.github.com>
Date: Thu, 13 Mar 2025 17:15:17 +0100
Subject: [PATCH 07/37] Delete public/default_avatar.png
---
public/default_avatar.png | Bin 18856 -> 0 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 public/default_avatar.png
diff --git a/public/default_avatar.png b/public/default_avatar.png
deleted file mode 100644
index a2cef1304d609ec05e1692bc699a1382483522d2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 18856
zcmZ5|dpy(c`~URTTT%&y7E?K;LegTfL}kwBL!k-1lg%L%v*l1J=glc3rb3vU%^{|f
zLn3lMHf0Vu%$n02!tb6w-+z7{4>jBUx)0a+dS2JP2s0DZ-rdmM5C~+izTRaE2xJEe
z0^u3j^)GnmgWv`52874g0;K~fY?GJ*fAG3$8*4)#B_x4APCLQh{CD)O`9dK3K5>6}
zn!Ivvf;YwQUb%YL((Be;e