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

show correct number of active users

Markus Kahl0a3eb86bd85a
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 8e469939b6e..db8f5b0a017 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -36,7 +36,7 @@ See docs/COPYRIGHT.rdoc for more details.
end
%>
<% users_info = user_limit && content_tag(:div) do %>
- <%= t(:label_enterprise_active_users, current: User.active.count, limit: user_limit) %>
+ <%= t(:label_enterprise_active_users, current: OpenProject::Enterprise.active_user_count, limit: user_limit) %>
&nbsp;
<a href="<%= OpenProject::Enterprise.upgrade_path %>" class="display-inline button -tiny -highlight" title="<%= t(:title_enterprise_upgrade) %>"><%= t(:button_upgrade) %></a>
<% end %>
diff --git a/spec/views/users/index.html.erb_spec.rb b/spec/views/users/index.html.erb_spec.rb
index e65d69d7048..e004a5423d3 100644
--- a/spec/views/users/index.html.erb_spec.rb
+++ b/spec/views/users/index.html.erb_spec.rb
@@ -33,6 +33,8 @@ describe 'users/index', type: :view do
let!(:user) { FactoryBot.create :user, firstname: "Scarlet", lastname: "Scallywag" }
before do
+ User.system # create system user which is active but should not count towards limit
+
assign(:users, [admin, user])
assign(:status, "all")
assign(:groups, Group.all)