Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#55581] reduce ABC in avatar helper

Tobias Dillmann9a9e7b2a9123
diff --git a/modules/avatars/app/helpers/avatar_helper.rb b/modules/avatars/app/helpers/avatar_helper.rb
index 750b8be7ed7..3d5c9074a53 100644
--- a/modules/avatars/app/helpers/avatar_helper.rb
+++ b/modules/avatars/app/helpers/avatar_helper.rb
@@ -108,14 +108,7 @@ module AvatarHelper
title: tag_options.fetch(:title, "")
}
- # The hover card will be triggered by hovering over the avatar (if enabled)
- hover_card = tag_options[:hover_card]
- if hover_card.fetch(:active, false)
- inputs[:hoverCard] = true
- inputs[:hoverCardModalTarget] = hover_card.fetch(:target, :default)
-
- inputs[:hoverCardUrl] = hover_card_user_path(user.id)
- end
+ inputs = hover_card_options(user, inputs, tag_options)
angular_component_tag "opce-principal",
class: tag_options[:class],
@@ -148,4 +141,19 @@ module AvatarHelper
object.mail
end
end
+
+ private
+
+ def hover_card_options(user, inputs = {}, tag_options = {})
+ # The hover card will be triggered by hovering over the avatar (if enabled)
+ hover_card = tag_options[:hover_card]
+ if hover_card.fetch(:active, false)
+ inputs[:hoverCard] = true
+ inputs[:hoverCardModalTarget] = hover_card.fetch(:target, :default)
+
+ inputs[:hoverCardUrl] = hover_card_user_path(user.id)
+ end
+
+ inputs
+ end
end