Skip to content

Commit

Permalink
Merge pull request #14737 from opf/fix/52660/default-modules-gantt
Browse files Browse the repository at this point in the history
Display multiple module dependency errors when saving default project settings
  • Loading branch information
dombesz authored Feb 7, 2024
2 parents 8bac8e4 + 9184781 commit 682046a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions app/controllers/admin/settings/projects_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@ def validate_enabled_modules

module_missing_deps = OpenProject::AccessControl
.modules
.detect { |m| m[:dependencies] && enabled_modules.include?(m[:name]) && (m[:dependencies] & enabled_modules) != m[:dependencies] }

if module_missing_deps
flash[:error] = I18n.t(
'settings.projects.missing_dependencies',
module: I18n.t("project_module_#{module_missing_deps[:name]}"),
dependencies: module_missing_deps[:dependencies].map { |dep| I18n.t("project_module_#{dep}") }.join(', ')
)
.select { |m| m[:dependencies] && enabled_modules.include?(m[:name]) && (m[:dependencies] & enabled_modules) != m[:dependencies] }
.map do |m|
I18n.t(
'settings.projects.missing_dependencies',
module: I18n.t("project_module_#{m[:name]}"),
dependencies: m[:dependencies].map { |dep|I18n.t("project_module_#{dep}") }.join(', ')
)
end

if module_missing_deps.any?
flash[:error] = helpers.list_of_messages(module_missing_deps)

redirect_to action: :show
end
Expand Down

0 comments on commit 682046a

Please sign in to comment.