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

[#49588] Error on custom action button when baseline is ON

Dombi Attila856b4dc4b500
diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts
index d93adc542cc..add9abc625f 100644
--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/wp-custom-actions/wp-custom-action.component.ts
@@ -50,13 +50,15 @@ export class WpCustomActionComponent {
@Input() action:CustomActionResource;
- constructor(private halResourceService:HalResourceService,
+ constructor(
+ private halResourceService:HalResourceService,
private apiV3Service:ApiV3Service,
private wpSchemaCacheService:SchemaCacheService,
private wpActivity:WorkPackagesActivityService,
private notificationService:WorkPackageNotificationService,
private halEditing:HalResourceEditingService,
- private halEvents:HalEventsService) {
+ private halEvents:HalEventsService,
+ ) {
}
private fetchAction() {
@@ -80,7 +82,7 @@ export class WpCustomActionComponent {
lockVersion: this.workPackage.lockVersion,
_links: {
workPackage: {
- href: this.workPackage.href,
+ href: this.workPackage.previewPath(),
},
},
};
diff --git a/spec/features/work_packages/custom_actions/custom_actions_spec.rb b/spec/features/work_packages/custom_actions/custom_actions_spec.rb
index 1996dd44125..936a4c56f8e 100644
--- a/spec/features/work_packages/custom_actions/custom_actions_spec.rb
+++ b/spec/features/work_packages/custom_actions/custom_actions_spec.rb
@@ -499,4 +499,31 @@ RSpec.describe 'Custom actions',
find('[data-field-name="estimatedTime"]').click
expect(page).to have_selector("#wp-#{work_package.id}-inline-edit--field-estimatedTime[disabled]")
end
+
+ context 'with baseline enabled' do
+ let(:wp_table) { Pages::WorkPackagesTable.new(project) }
+ let(:query) do
+ create(:query,
+ name: 'Timestamps Query',
+ project:,
+ user:,
+ timestamps: ["P-1d", "PT0S"])
+ end
+
+ before do
+ create(:custom_action,
+ actions: [CustomActions::Actions::AssignedTo.new(value: nil)],
+ name: 'Unassign')
+ end
+
+ it 'executes the custom action (Regression#49588)' do
+ login_as(user)
+ wp_table.visit_query(query)
+ wp_page = wp_table.open_full_screen_by_link(work_package)
+
+ wp_page.ensure_page_loaded
+
+ wp_page.click_custom_action('Unassign', expect_success: true)
+ end
+ end
end
diff --git a/spec/support/pages/work_packages/work_packages_table.rb b/spec/support/pages/work_packages/work_packages_table.rb
index b09d6297ca0..b062eb557fe 100644
--- a/spec/support/pages/work_packages/work_packages_table.rb
+++ b/spec/support/pages/work_packages/work_packages_table.rb
@@ -183,7 +183,7 @@ module Pages
end
def open_full_screen_by_link(work_package)
- row(work_package).click_link(work_package.id)
+ row(work_package).click_link(work_package.id.to_s)
FullWorkPackage.new(work_package)
end