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

Fix editing issue priorities

Oliver Güntherb61c0b19fd4c
diff --git a/app/views/admin/settings/work_package_priorities/edit.html.erb b/app/views/admin/settings/work_package_priorities/edit.html.erb
index 48ae3a3131b..8d359a45514 100644
--- a/app/views/admin/settings/work_package_priorities/edit.html.erb
+++ b/app/views/admin/settings/work_package_priorities/edit.html.erb
@@ -43,6 +43,6 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
-<%= primer_form_with(model: @enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
+<%= primer_form_with(model: @enumeration, scope: :enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
<%= render(Admin::Enumerations::ItemForm.new(f)) %>
<% end %>
diff --git a/modules/costs/app/views/admin/settings/time_entry_activities/edit.html.erb b/modules/costs/app/views/admin/settings/time_entry_activities/edit.html.erb
index a9016dffcd3..f141496879e 100644
--- a/modules/costs/app/views/admin/settings/time_entry_activities/edit.html.erb
+++ b/modules/costs/app/views/admin/settings/time_entry_activities/edit.html.erb
@@ -43,6 +43,6 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
-<%= primer_form_with(model: @enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
+<%= primer_form_with(model: @enumeration, scope: :enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
<%= render(Admin::Enumerations::ItemForm.new(f)) %>
<% end %>
diff --git a/modules/costs/spec/features/time_entry/activity_spec.rb b/modules/costs/spec/features/time_entry/activity_spec.rb
index bc3bcb0d2d9..9055793499b 100644
--- a/modules/costs/spec/features/time_entry/activity_spec.rb
+++ b/modules/costs/spec/features/time_entry/activity_spec.rb
@@ -46,21 +46,32 @@ RSpec.describe "Time entry activity" do
# we are redirected back to the index page
expect(page).to have_current_path(admin_settings_time_entry_activities_path)
-
expect(page).to have_content("A new activity")
+ # It allows editing (Regression #62459)
+ click_link "A new activity"
+
+ fill_in "Name", with: "Development"
+ click_on("Save")
+
+ expect(page).to have_current_path(admin_settings_time_entry_activities_path)
+ expect(page).to have_content("Development")
+
+ expect(TimeEntryActivity).to exist(name: "Development")
+ expect(TimeEntryActivity).not_to exist(name: "A new activity")
+
visit project_settings_general_path(project)
click_on "Time tracking activities"
- expect(page).to have_field("A new activity", checked: true)
+ expect(page).to have_field("Development", checked: true)
- uncheck "A new activity"
+ uncheck "Development"
click_on "Save"
expect(page).to have_content "Successful update."
- expect(page).to have_field("A new activity", checked: false)
+ expect(page).to have_field("Development", checked: false)
end
end
diff --git a/modules/documents/app/views/admin/settings/document_categories/edit.html.erb b/modules/documents/app/views/admin/settings/document_categories/edit.html.erb
index 61242a48df3..c1fb93378a5 100644
--- a/modules/documents/app/views/admin/settings/document_categories/edit.html.erb
+++ b/modules/documents/app/views/admin/settings/document_categories/edit.html.erb
@@ -26,7 +26,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t("documents.categories") %>
+<% html_title t(:label_administration), t("documents.label_categories") %>
<%=
render(Primer::OpenProject::PageHeader.new) do |header|
@@ -35,13 +35,13 @@ See COPYRIGHT and LICENSE files for more details.
[
{ href: admin_index_path, text: t("label_administration") },
{ href: admin_settings_storages_path, text: t("project_module_storages") },
- { href: url_for(action: :index), text: t("documents.categories") },
+ { href: url_for(action: :index), text: t("documents.label_categories") },
@enumeration.name
]
)
end
%>
-<%= primer_form_with(model: @enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
+<%= primer_form_with(model: @enumeration, scope: :enumeration, url: url_for(action: :update, id: @enumeration)) do |f| %>
<%= render(Admin::Enumerations::ItemForm.new(f)) %>
<% end %>
diff --git a/modules/documents/spec/features/document_categories_spec.rb b/modules/documents/spec/features/document_categories_spec.rb
index dc32243c452..676553e55cb 100644
--- a/modules/documents/spec/features/document_categories_spec.rb
+++ b/modules/documents/spec/features/document_categories_spec.rb
@@ -45,7 +45,18 @@ RSpec.describe "Document categories" do
# we are redirected back to the index page
expect(page).to have_current_path(admin_settings_document_categories_path)
-
expect(page).to have_content("Documentation")
+
+ # It allows editing (Regression #62459)
+ click_link "Documentation"
+
+ fill_in "Name", with: "Specification"
+ click_on("Save")
+
+ expect(page).to have_current_path(admin_settings_document_categories_path)
+ expect(page).to have_content("Specification")
+
+ expect(DocumentCategory).to exist(name: "Specification")
+ expect(DocumentCategory).not_to exist(name: "Documentation")
end
end
diff --git a/spec/features/admin/settings/work_package_priorities_spec.rb b/spec/features/admin/settings/work_package_priorities_spec.rb
index 847690abdd9..78a4e6d4492 100644
--- a/spec/features/admin/settings/work_package_priorities_spec.rb
+++ b/spec/features/admin/settings/work_package_priorities_spec.rb
@@ -47,7 +47,18 @@ RSpec.describe "Work package priorities" do
# we are redirected back to the index page
expect(page).to have_current_path(admin_settings_work_package_priorities_path)
-
expect(page).to have_content("Immediate")
+
+ # It allows editing (Regression #62459)
+ click_link "Immediate"
+
+ fill_in "Name", with: "Urgent"
+ click_on("Save")
+
+ expect(page).to have_current_path(admin_settings_work_package_priorities_path)
+ expect(page).to have_content("Urgent")
+
+ expect(IssuePriority).to exist(name: "Urgent")
+ expect(IssuePriority).not_to exist(name: "Immediate")
end
end