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

Change the text of the user limit warning

Henriette Darge557d4b79eddc
diff --git a/app/components/work_packages/share/invite_user_form_component.html.erb b/app/components/work_packages/share/invite_user_form_component.html.erb
index 89d370ada54..0b8653bd243 100644
--- a/app/components/work_packages/share/invite_user_form_component.html.erb
+++ b/app/components/work_packages/share/invite_user_form_component.html.erb
@@ -37,7 +37,8 @@
end
user_limit_row.with_column do
- render(Primer::Beta::Text.new(color: :danger)) { I18n.t('work_package.sharing.text_user_limit_reached', count: OpenProject::Enterprise.open_seats_count) }
+ render(Primer::Beta::Text.new(color: :danger)) { I18n.t("work_package.sharing.warning_user_limit_reached#{'_admin' if User.current.admin?}",
+ upgrade_url: OpenProject::Enterprise.upgrade_url).html_safe }
end
end
end
diff --git a/app/controllers/concerns/accounts/user_limits.rb b/app/controllers/concerns/accounts/user_limits.rb
index 575136a17c7..649e3508c91 100644
--- a/app/controllers/concerns/accounts/user_limits.rb
+++ b/app/controllers/concerns/accounts/user_limits.rb
@@ -89,10 +89,16 @@ module Accounts::UserLimits
end
def user_limit_warning
- warning = I18n.t(
- :warning_user_limit_reached,
- upgrade_url: OpenProject::Enterprise.upgrade_url
- )
+ warning = if current_user.admin?
+ I18n.t(
+ :warning_user_limit_reached_admin,
+ upgrade_url: OpenProject::Enterprise.upgrade_url
+ )
+ else
+ I18n.t(
+ :warning_user_limit_reached
+ )
+ end
warning.html_safe
end
diff --git a/app/views/members/_member_form.html.erb b/app/views/members/_member_form.html.erb
index 187ccb2eed1..fa56e3d7105 100644
--- a/app/views/members/_member_form.html.erb
+++ b/app/views/members/_member_form.html.erb
@@ -104,7 +104,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="op-toast -warning icon-warning d-none"
data-user-limit-target="limitWarning">
<div class="op-toast--content">
- <p><%= I18n.t(:warning_user_limit_reached, upgrade_url: OpenProject::Enterprise.upgrade_path).html_safe %></p>
+ <p><%= I18n.t("warning_user_limit_reached#{'_admin' if current_user.admin?}", upgrade_url: OpenProject::Enterprise.upgrade_url).html_safe %></p>
</div>
</div>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5f5a133c40b..2e273e904fa 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3200,8 +3200,9 @@ en:
The activation email has expired. We sent you a new one to %{email}.
Please click the link inside of it to activate your account.
warning_user_limit_reached: >
- User limit reached. You cannot activate any more users.
- Please <a href="%{upgrade_url}">upgrade your plan</a> or block members to allow for additional users.
+ Adding additional users will exceed the current limit. Please contact an administrator to increase the user limit to ensure external users are able to access this instance.
+ warning_user_limit_reached_admin: >
+ Adding additional users will exceed the current limit. Please <a href="%{upgrade_url}">upgrade your plan</a> to be able to ensure external users are able to access this instance.
warning_user_limit_reached_instructions: >
You reached your user limit (%{current}/%{max} active users).
Please contact [email protected] to upgrade your Enterprise edition plan and add additional users.
@@ -3265,10 +3266,12 @@ en:
share: "Share"
text_empty_state_description: "The work package has not been shared with anyone yet."
text_empty_state_header: "No shared users"
- text_user_limit_reached:
- zero: "This instance has reached its user limit, you can’t share with new users. Please contact your administrator to add more members."
- one: "Only 1 member left to reach the user limit of the instance. Please contact your administrator."
- other: "Only %{count} members left to reach the user limit of the instance. Please contact your administrator."
+ text_user_limit_reached: "Adding additional users will exceed the current limit. Please contact an administrator to increase the user limit to ensure external users are able to access this work package."
+ text_user_limit_reached_admins: 'Adding additional users will exceed the current limit. Please <a href="%{upgrade_url}">upgrade your plan</a> to be able to add more users.'
+ warning_user_limit_reached: >
+ Adding additional users will exceed the current limit. Please contact an administrator to increase the user limit to ensure external users are able to access this work package.
+ warning_user_limit_reached_admin: >
+ Adding additional users will exceed the current limit. Please <a href="%{upgrade_url}">upgrade your plan</a> to be able to ensure external users are able to access this work package.
working_days:
info: >
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 6b637f9cd48..fd537b8b5dc 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe UsersController do
end
it "shows a user limit error" do
- expect(flash[:error]).to match /user limit reached/i
+ expect(flash[:error]).to match /Adding additional users will exceed the current limit/i
end
it "redirects back to the user index" do
@@ -96,7 +96,7 @@ RSpec.describe UsersController do
end
it "shows a user limit warning" do
- expect(flash[:warning]).to match /user limit reached/i
+ expect(flash[:warning]).to match /Adding additional users will exceed the current limit/i
end
it "shows the new user page" do
@@ -451,7 +451,7 @@ RSpec.describe UsersController do
let(:user_limit_reached) { true }
it "shows the user limit reached error and recommends to upgrade" do
- expect(flash[:error]).to match /user limit reached.*upgrade/i
+ expect(flash[:error]).to match /Adding additional users will exceed the current limit.*upgrade/i
end
it "does not activate the user" do
diff --git a/spec/features/members/invitation_spec.rb b/spec/features/members/invitation_spec.rb
index 04664fc927b..ab546fc78ed 100644
--- a/spec/features/members/invitation_spec.rb
+++ b/spec/features/members/invitation_spec.rb
@@ -75,7 +75,6 @@ RSpec.describe 'invite user via email', js: true do
before do
allow(OpenProject::Enterprise).to receive_messages(
user_limit: 10,
- user_limit_reached?: false,
open_seats_count: 1
)
end
@@ -87,15 +86,13 @@ RSpec.describe 'invite user via email', js: true do
members_page.search_and_select_principal! '[email protected]',
'Send invite to [email protected]'
- expect(members_page).not_to have_text sanitize_string(I18n.t(:warning_user_limit_reached,
- upgrade_url: OpenProject::Enterprise.upgrade_path)),
+ expect(members_page).not_to have_text sanitize_string(I18n.t(:warning_user_limit_reached)),
normalize_ws: true
members_page.search_and_select_principal! '[email protected]',
'Send invite to [email protected]'
- expect(members_page).to have_text sanitize_string(I18n.t(:warning_user_limit_reached,
- upgrade_url: OpenProject::Enterprise.upgrade_path)),
+ expect(members_page).to have_text sanitize_string(I18n.t(:warning_user_limit_reached)),
normalize_ws: true
end
end
diff --git a/spec/features/work_packages/share/multi_invite_spec.rb b/spec/features/work_packages/share/multi_invite_spec.rb
index c4dda2f66bb..edbe7e8d46f 100644
--- a/spec/features/work_packages/share/multi_invite_spec.rb
+++ b/spec/features/work_packages/share/multi_invite_spec.rb
@@ -260,7 +260,6 @@ RSpec.describe 'Work package sharing',
before do
allow(OpenProject::Enterprise).to receive_messages(
user_limit: 10,
- user_limit_reached?: false,
open_seats_count: 1
)
end
@@ -275,7 +274,7 @@ RSpec.describe 'Work package sharing',
# Add another non-existing user that would exceed the user limit
share_modal.select_not_existing_user_option "[email protected]"
- share_modal.expect_user_limit_warning(open_seats: 1)
+ share_modal.expect_user_limit_warning
end
end
end
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index c9a65ea6303..9ad2e1e83ef 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -354,10 +354,10 @@ module Components
end
end
- def expect_user_limit_warning(open_seats:)
+ def expect_user_limit_warning
within modal_element do
expect(page)
- .to have_text(I18n.t('work_package.sharing.text_user_limit_reached', count: open_seats))
+ .to have_text(I18n.t('work_package.sharing.warning_user_limit_reached'))
end
end
end