diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 3856a138ee..776529ae11 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -135,6 +135,14 @@ If this option is active /login will lead directly to the configured omniauth pr Note that this does not stop a user from manually navigating to any other omniauth provider if additional ones are configured. + +### Gravatar images + +OpenProject uses gravatar images with a `404` fallback by default to render an internal, initials-based avatar. +You can override this behavior by setting `gravatar_fallback_image` to a different value. + +For supported values, please see https://en.gravatar.com/site/implement/images/ + ### attachments storage *default: file* diff --git a/lib/open_project/configuration.rb b/lib/open_project/configuration.rb index 4374e54fdd..8fb8e04af8 100644 --- a/lib/open_project/configuration.rb +++ b/lib/open_project/configuration.rb @@ -129,6 +129,9 @@ module OpenProject # Allow in-context translations to be loaded with CSP 'crowdin_in_context_translations' => true, + # Default gravatar image, set to something other than 404 + # to ensure a default is returned + 'gravatar_fallback_image' => '404', 'registration_footer' => {}, diff --git a/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb b/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb index 608e987282..55090266c4 100644 --- a/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb +++ b/modules/avatars/lib/open_project/avatars/patches/avatar_helper_patch.rb @@ -119,7 +119,7 @@ AvatarHelper.class_eval do def default_gravatar_options options = { secure: Setting.protocol == 'https' } - options[:default] = '404' + options[:default] = OpenProject::Configuration.gravatar_fallback_image options end