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

[#59925] fix user login display in user list

Tobias Dillmann4c8ece6eccdc
diff --git a/app/components/users/row_component.rb b/app/components/users/row_component.rb
index ac8c2dcac97..6b5d34c8d6f 100644
--- a/app/components/users/row_component.rb
+++ b/app/components/users/row_component.rb
@@ -48,6 +48,7 @@ module Users
link = helpers.link_to_user(user,
class: "op-principal--name",
+ name: user.login,
href: helpers.allowed_management_user_profile_path(user))
icon + link
diff --git a/lib/open_project/object_linking.rb b/lib/open_project/object_linking.rb
index 4893feb5b86..88be7de82d7 100644
--- a/lib/open_project/object_linking.rb
+++ b/lib/open_project/object_linking.rb
@@ -43,23 +43,19 @@ module OpenProject
# Displays a link to user's account page if active or registered
def link_to_user(user, options = {})
- if user.is_a?(User) && user.locked?
- user.name
- elsif user.is_a?(User)
- only_path = options.delete(:only_path) { true }
- name = user.name
- href = user_url(user, only_path:)
- options[:title] ||= I18n.t(:label_user_named, name:)
+ return h(user.to_s) unless user.is_a?(User)
+ return h(user.name) if user.locked? && !User.current.admin?
- add_hover_card_options(user, options, only_path:, clazz_key: :class)
+ only_path = options.delete(:only_path) { true }
+ name = options.delete(:name) { user.name }
+ options[:title] ||= I18n.t(:label_user_named, name:)
- link_to(name, href, options)
- else
- h(user.to_s)
- end
+ add_hover_card_options(user, options, only_path:, clazz_key: :class)
+
+ link_to(name, user_url(user, only_path:), options)
end
- # Displays a link to groups's account page
+ # Displays a link to group's account page
def link_to_group(group, options = {})
return h(group.to_s) unless group.is_a?(Group)
diff --git a/spec/features/users/index_spec.rb b/spec/features/users/index_spec.rb
index f5deb88dae6..c6ba2cd1ea7 100644
--- a/spec/features/users/index_spec.rb
+++ b/spec/features/users/index_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH