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

[32168] Reload query in all cases

Oliver Güntherf615767af156
diff --git a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts
index f5598505e13..61aad136d57 100644
--- a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts
+++ b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts
@@ -144,7 +144,7 @@ export class WpDestroyModal extends OpModalComponent implements OnInit {
* since the WP in view (split/full) does not exist any more.
*/
if (this.$state.current.name !== 'work-packages.list') {
- this.backRoutingService.goBack(true, { reload: true });
+ this.backRoutingService.goBack(true);
}
})
.catch(() => {
diff --git a/frontend/src/app/modules/common/back-routing/back-routing.service.ts b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
index b4c74a8f148..d00362cf05c 100644
--- a/frontend/src/app/modules/common/back-routing/back-routing.service.ts
+++ b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
@@ -46,20 +46,20 @@ export class BackRoutingService {
constructor(protected injector:Injector) {
}
- public goBack(preferListOverSplit:boolean = false, opts:Partial<TransitionOptions> = {}) {
+ public goBack(preferListOverSplit:boolean = false) {
// Default: back to list
// When coming from a deep link or a create form
if (!this.backRoute || this.backRoute.name.includes('new')) {
- this.$state.go('work-packages.list', this.$state.params, opts);
+ this.$state.go('work-packages.list', this.$state.params);
} else {
if (this.keepTab.isDetailsState(this.backRoute.parent)) {
if (preferListOverSplit) {
- this.$state.go('work-packages.list', this.$state.params, opts);
+ this.$state.go('work-packages.list', this.$state.params);
} else {
- this.$state.go(this.keepTab.currentDetailsState, this.$state.params, opts);
+ this.$state.go(this.keepTab.currentDetailsState, this.$state.params);
}
} else {
- this.$state.go(this.backRoute.name, this.backRoute.params, opts);
+ this.$state.go(this.backRoute.name, this.backRoute.params);
}
}
}
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
index c45f469a7a9..900f8a1f0fd 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
@@ -100,8 +100,10 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O
this.hasQueryProps = !!this.$state.params.query_props;
- // Load query initially unless it already was loaded
- if (!this.querySpace.initialized.hasValue()) {
+ // If the query was loaded, reload invisibly
+ if (this.querySpace.initialized.hasValue()) {
+ this.refresh();
+ } else {
this.loadCurrentQuery();
}
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index a83085bdf83..44e09ebb5ea 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -211,6 +211,38 @@ RSpec.feature 'Work package navigation', js: true, selenium: true do
end
end
+ describe 'moving back to filtered list after change' do
+ let!(:work_package) { FactoryBot.create(:work_package, project: project, subject: 'foo') }
+ let!(:query) do
+ query = FactoryBot.build(:query, user: user, project: project)
+ query.column_names = %w(id subject)
+ query.name = "My fancy query"
+ query.add_filter('subject', '~', ['foo'])
+
+ query.save!
+ query
+ end
+
+ it 'will filter out the work package' do
+ wp_table = Pages::WorkPackagesTable.new project
+ wp_table.visit!
+
+ wp_table.expect_work_package_listed work_package
+ full_view = wp_table.open_full_screen_by_link work_package
+
+ full_view.ensure_page_loaded
+ subject = full_view.edit_field :subject
+ subject.update 'bar'
+
+ full_view.expect_and_dismiss_notification message: 'Successful update.'
+
+ # Go back to list
+ find('.work-packages-back-button').click
+
+ wp_table.ensure_work_package_not_listed! work_package
+ end
+ end
+
context 'work package with an attachment' do
let!(:attachment) { FactoryBot.build(:attachment, filename: 'attachment-first.pdf') }
let!(:wp_with_attachment) do