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

Add confirmation before deleting a time entry

Henriette Dinger18be9763f3ca
diff --git a/frontend/src/app/modules/time_entries/edit/edit.modal.ts b/frontend/src/app/modules/time_entries/edit/edit.modal.ts
index 7c9ff9d64e1..a2c4ca1bda5 100644
--- a/frontend/src/app/modules/time_entries/edit/edit.modal.ts
+++ b/frontend/src/app/modules/time_entries/edit/edit.modal.ts
@@ -29,6 +29,10 @@ export class TimeEntryEditModal extends TimeEntryBaseModal {
}
public destroy() {
+ if (!window.confirm(this.text.areYouSure)) {
+ return;
+ }
+
this.destroyedEntry = this.entry;
this.service.close();
}
diff --git a/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts b/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts
index 7d4ff5e324f..824a12ddf64 100644
--- a/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts
+++ b/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts
@@ -14,6 +14,7 @@ export abstract class TimeEntryBaseModal extends OpModalComponent {
cancel: this.i18n.t('js.button_cancel'),
close: this.i18n.t('js.button_close'),
delete: this.i18n.t('js.button_delete'),
+ areYouSure: this.i18n.t('js.text_are_you_sure'),
};
public closeOnEscape = false;
diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
index 2cea38f0f47..f63b7e8cb11 100644
--- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
+++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
@@ -266,6 +266,7 @@ describe 'My page time entries current user widget spec', type: :feature, js: tr
end
click_button 'Delete'
+ page.driver.browser.switch_to.alert.accept
within entries_area.area do
expect(page)