From 294ab0fffd8776f9b79a458a276cdce89b0d2fa6 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 29 May 2018 17:51:30 -0700 Subject: [PATCH] Fix local storage not being cleared after creating a new issue Creating a new issue will always result in a 302 redirect to the newly-created issue. This reverts the change introduced in https://gitlab.com/gitlab-org/gitlab-ce/commit/7684217d6806408cd338260119364419260d1720 to handle the case where a user is in the middle of creating a new form and redirected to accepting the terms of service. Closes #37162 --- app/assets/javascripts/issuable_form.js | 2 +- .../unreleased/sh-fix-submit-not-clearing-local-storage.yml | 5 +++++ spec/features/users/terms_spec.rb | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/sh-fix-submit-not-clearing-local-storage.yml diff --git a/app/assets/javascripts/issuable_form.js b/app/assets/javascripts/issuable_form.js index 90d4e19e90b..bb8b3d91e40 100644 --- a/app/assets/javascripts/issuable_form.js +++ b/app/assets/javascripts/issuable_form.js @@ -30,7 +30,7 @@ export default class IssuableForm { } this.initAutosave(); - this.form.on('submit:success', this.handleSubmit); + this.form.on('submit', this.handleSubmit); this.form.on('click', '.btn-cancel', this.resetAutosave); this.initWip(); diff --git a/changelogs/unreleased/sh-fix-submit-not-clearing-local-storage.yml b/changelogs/unreleased/sh-fix-submit-not-clearing-local-storage.yml new file mode 100644 index 00000000000..422143aa5e6 --- /dev/null +++ b/changelogs/unreleased/sh-fix-submit-not-clearing-local-storage.yml @@ -0,0 +1,5 @@ +--- +title: Fix local storage not being cleared after creating a new issue +merge_request: +author: +type: fixed diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb index f9469adbfe3..1efa5cd5490 100644 --- a/spec/features/users/terms_spec.rb +++ b/spec/features/users/terms_spec.rb @@ -62,7 +62,8 @@ describe 'Users > Terms' do expect(current_path).to eq(project_issues_path(project)) end - it 'redirects back to the page the user was trying to save' do + # Disabled until https://gitlab.com/gitlab-org/gitlab-ce/issues/37162 is solved properly + xit 'redirects back to the page the user was trying to save' do visit new_project_issue_path(project) fill_in :issue_title, with: 'Hello world, a new issue'