Feature #44684
openShow the built-in initials avatar for users without a Gravatar image
Description
When Gravatar is enabled, users who have not registered an image on Gravatar are shown the image chosen in "Default Gravatar image". If no default image is selected, Gravatar returns its own logo, so all of these users get the same image and are hard to tell apart. This patch shows Redmine's built-in initials avatar for these users instead. Redmine already uses this avatar when Gravatar is disabled, so these users look the same whether Gravatar is enabled or not.
| Before | After |
|---|---|
|
|
Gravatar can generate initials images itself (the "Initials" option), but this has two problems. First, it raises a privacy concern for users with Chinese, Japanese or Korean names. To generate the initials, the first character of each part of the name is sent to Gravatar. These names are usually three or four characters long, so the two initials are half or more of the name. For example, my name is "前田 剛" (Go Maeda), which has three characters, and "前剛", two of those three characters, is sent to Gravatar. For two-character names, which are not unusual in Chinese, the initials are the whole name. Much of the user's name is therefore sent to an external service. Second, the result looks different from the initials avatar used elsewhere in Redmine, as shown in the screenshot below (compare it with the "After" screenshot above). The built-in initials avatar is drawn by Redmine itself, so no name is sent to an external service.

This patch implements the fallback as follows. When "Default Gravatar image" is blank, the Gravatar URL is requested with d=404, so Gravatar returns HTTP 404 for email addresses that have no registered image. A Stimulus controller (initials-avatar-fallback) catches the image's error event and replaces the image with Redmine's built-in initials avatar. It also handles images that failed to load before the controller connected. If a default image such as Identicon or Retro is selected, nothing changes.
In Administration > Settings > Display, the blank option is now labelled "Initials (built-in)" and the existing "initials" option is now labelled "Initials (Gravatar)", so the two are easy to tell apart. The default value of gravatar_default in config/settings.yml is changed from identicon to blank, so new installations use the built-in initials avatar. As a result, users without a Gravatar image are shown the same initials avatar whether "Use Gravatar user icons" is enabled or not. Enabling Gravatar only changes the avatars of users who have registered an image there. Existing installations are not affected, because the selected default image is saved when Gravatar is enabled on the settings page.
| Before | After |
|---|---|
|
|
The text text_avatar_from_server_html on the avatar page is updated so that it is also correct when a default avatar is shown. The new English text has been copied to all locales, so translators will need to update it.
Files
No data to display