Project

General

Profile

Feature #44684 » 0001-Show-initials-avatar-for-users-without-Gravatar-when.patch

Go MAEDA, 2026-10-27 10:08

View differences:

app/helpers/avatars_helper.rb
def gravatar_avatar_tag(user, options)
options[:default] = Setting.gravatar_default
if options[:default].blank? && user.respond_to?(:initials) && user.initials.present?
# Gravatar responds with 404 if no avatar is registered for the email,
# then the image is replaced with the initials avatar on the client side
options[:default] = '404'
options[:data] = {
controller: 'initials-avatar-fallback',
action: 'error->initials-avatar-fallback#replace',
initials_avatar_fallback_initials_value: user.initials,
initials_avatar_fallback_class_value: initials_avatar_css_class(user, options)
}
end
options[:class] = [GravatarHelper::DEFAULT_OPTIONS[:class], options[:class]].compact.join(' ')
email = extract_email_from_user(user)
......
end
def initials_avatar_tag(user, options)
size = (options.delete(:size) || GravatarHelper::DEFAULT_OPTIONS[:size]).to_i
css_class = ["avatar-color-#{user.id % 8}", "s#{size}", options[:class]].compact.join(' ')
css_class = initials_avatar_css_class(user, options)
content_tag('span', user.initials, role: 'img', class: css_class, title: options[:title])
end
def initials_avatar_css_class(user, options)
size = (options[:size] || GravatarHelper::DEFAULT_OPTIONS[:size]).to_i
["avatar-color-#{user.id % 8}", "s#{size}", options[:class]].compact.join(' ')
end
def extract_email_from_user(user)
if user.respond_to?(:mail)
user.mail
app/javascript/controllers/initials_avatar_fallback_controller.js
import { Controller } from "@hotwired/stimulus";
export default class extends Controller {
static values = { initials: String, class: String };
connect() {
// The image may have failed to load before the controller was connected
const failedToLoad = this.element.complete && this.element.naturalWidth === 0;
if (failedToLoad) this.replace();
}
replace() {
const span = document.createElement("span");
span.setAttribute("role", "img");
span.className = this.classValue;
span.textContent = this.initialsValue;
if (this.element.title) span.title = this.element.title;
this.element.replaceWith(span);
}
}
config/locales/ar.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/az.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/bg.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/bs.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/ca.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/cs.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/da.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/de.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/el.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/en-GB.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/en.yml
text_select_apply_issue_status: "Select issue status"
text_avatar_server_config_html: The current avatar server is <a href="%{url}">%{url}</a>. You can configure it in config/configuration.yml.
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated with the user's email address is currently used as the avatar. It can be changed on that site.
text_avatar_from_server_html: The image associated with the user's email address on <a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
text_avatar_upload_disabled: Uploading an avatar image to Redmine has been disabled by the administrator.
config/locales/es-PA.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/es.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/et.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/eu.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/fa.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/fi.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/fr.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/gl.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/he.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/hr.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/hu.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/id.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/it.yml
text_select_apply_issue_status: "Seleziona lo stato della segnalazione"
text_avatar_server_config_html: "Il server corrente degli avatar è <a href=\"%{url}\">%{url}</a>. È possibile configurarlo in config/configuration.yml."
text_avatar_uploaded: L'immagine caricata è attualmente usata come avatar.
text_avatar_from_server_html: L'immagine di <a href="%{url}">%{url}</a> associata all'indirizzo email dell'utente è attualmente usata come avatar. Può essere modificata su quel sito.
text_avatar_from_server_html: The image associated with the user's email address on <a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: L'immagine generata dal nome dell'utente è attualmente usata come avatar.
text_avatar_upload_instead: Puoi invece caricare un'immagine da usare.
text_avatar_upload_disabled: Il caricamento di un'immagine avatar su Redmine è stato disabilitato dall'amministratore.
config/locales/ja.yml
setting_avatar_enabled: ユーザーによるアバターの設定を許可
button_change_avatar: アバター変更
text_avatar_uploaded: 現在はアップロードされた画像がアバターとして使用されています。
text_avatar_from_server_html: 現在は <a href="%{url}">%{url}</a> でユーザーのメールアドレスに関連づけられている画像がアバターとして使用されています。変更はそのサイトで行えます。
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: 現在はユーザーの名前から生成された画像がアバターとして使用されています。
text_avatar_upload_instead: 代わりに使用する画像をアップロードすることもできます。
text_avatar_upload_disabled: アバター画像のアップロードは管理者によって無効にされています。
config/locales/ko.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/lt.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/lv.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/mk.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/mn.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/nl.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/no.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/pl.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/pt-BR.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/pt.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/ro.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/ru.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sk.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sl.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sq.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sr-YU.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sr.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/sv.yml
setting_avatar_enabled: Tillåt användare att välja sin avatar
button_change_avatar: Ändra avatar
text_avatar_uploaded: Den uppladdade bilden används just nu som avatar.
text_avatar_from_server_html: 'Bilden från <a href="%{url}">%{url}</a> som hör till användarens e-postadress används just nu som avatar. Den kan bara ändras på den webbplatsen.'
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: Bilden som skapats av användarens namn används just nu som avatar.
text_avatar_upload_instead: Du kan ladda upp en bild att användas i stället.
text_avatar_upload_disabled: Administratören har stängt av uppladdning av avatarbilder till Redmine.
config/locales/ta-IN.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/th.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/tr.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/uk.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/vi.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/zh-TW.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
config/locales/zh.yml
setting_avatar_enabled: Allow users to set their avatar
button_change_avatar: Change avatar
text_avatar_uploaded: The uploaded image is currently used as the avatar.
text_avatar_from_server_html: The image from <a href="%{url}">%{url}</a> associated
with the user's email address is currently used as the avatar. It can be changed
on that site.
text_avatar_from_server_html: The image associated with the user's email address on
<a href="%{url}">%{url}</a> is currently used as the avatar. It can be changed on
that site. If no image is registered there, a default avatar is shown.
text_avatar_initials: The image generated from the user's name is currently used as
the avatar.
text_avatar_upload_instead: You can upload an image to use instead.
test/helpers/avatars_helper_test.rb
def test_avatar_source_info
Redmine::Thumbnail.stubs(:convert_available?).returns(true)
user = User.find(2)
assert_include 'It can be changed on that site. You can upload an image to use instead.', avatar_source_info(user)
assert_include 'a default avatar is shown. You can upload an image to use instead.', avatar_source_info(user)
with_settings :gravatar_enabled => '0' do
assert_include 'generated from the user', avatar_source_info(user)
end
......
end
end
def test_avatar_without_default_should_fall_back_to_initials_avatar
with_settings :gravatar_default => '' do
avatar_tag = avatar(User.find_by_mail('jsmith@somenet.foo'))
assert_include 'default=404', avatar_tag
assert_select_in avatar_tag, 'img[data-controller="initials-avatar-fallback"]' \
'[data-initials-avatar-fallback-initials-value="JS"]' \
'[data-initials-avatar-fallback-class-value="avatar-color-2 s24 avatar active"]'
end
end
def test_avatar_with_default_should_not_fall_back_to_initials_avatar
with_settings :gravatar_default => 'identicon' do
avatar_tag = avatar(User.find_by_mail('jsmith@somenet.foo'))
assert_include 'default=identicon', avatar_tag
assert_not_include 'initials-avatar-fallback', avatar_tag
end
end
def test_avatar_disabled_should_display_user_initials
with_settings :gravatar_enabled => '0' do
assert_equal "<span role=\"img\" class=\"avatar-color-2 s24 avatar active\">JS</span>", avatar(User.find_by_mail('jsmith@somenet.foo'))
test/system/avatars_test.rb
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006- Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require_relative '../application_system_test_case'
class AvatarsTest < ApplicationSystemTestCase
def test_gravatar_without_default_should_fall_back_to_initials_avatar_if_not_found
with_settings :gravatar_enabled => '1', :gravatar_default => '' do
# Requests to /avatar/:hash on Redmine itself respond with 404
Redmine::Configuration.with 'avatar_server_url' => '' do
log_user('jsmith', 'jsmith')
visit '/users/2'
assert_selector 'h2 span[role="img"].avatar.avatar-color-2.s50.active', :text => 'JS'
assert_no_selector 'h2 img.gravatar'
end
end
end
end
(6-6/8)