Commit 16ffb505 authored by Samantha Ming's avatar Samantha Ming Committed by Paul Slaughter

Avoid pre-popluation form for MR resolve issues

- Issue is due to writing to the wrong key
- Ensure the use of entire search if not MR

https://gitlab.com/gitlab-org/gitlab/merge_requests/22593
parent a38b6ab6
...@@ -8,19 +8,23 @@ import AutoWidthDropdownSelect from './issuable/auto_width_dropdown_select'; ...@@ -8,19 +8,23 @@ import AutoWidthDropdownSelect from './issuable/auto_width_dropdown_select';
import { parsePikadayDate, pikadayToString } from './lib/utils/datetime_utility'; import { parsePikadayDate, pikadayToString } from './lib/utils/datetime_utility';
import { queryToObject, objectToQuery } from './lib/utils/url_utility'; import { queryToObject, objectToQuery } from './lib/utils/url_utility';
const MR_SOURCE_BRANCH = 'merge_request[source_branch]';
const MR_TARGET_BRANCH = 'merge_request[target_branch]';
function organizeQuery(obj, isFallbackKey = false) { function organizeQuery(obj, isFallbackKey = false) {
const sourceBranch = 'merge_request[source_branch]'; if (!obj[MR_SOURCE_BRANCH] && !obj[MR_TARGET_BRANCH]) {
const targetBranch = 'merge_request[target_branch]'; return obj;
}
if (isFallbackKey) { if (isFallbackKey) {
return { return {
[sourceBranch]: obj[sourceBranch], [MR_SOURCE_BRANCH]: obj[MR_SOURCE_BRANCH],
}; };
} }
return { return {
[sourceBranch]: obj[sourceBranch], [MR_SOURCE_BRANCH]: obj[MR_SOURCE_BRANCH],
[targetBranch]: obj[targetBranch], [MR_TARGET_BRANCH]: obj[MR_TARGET_BRANCH],
}; };
} }
...@@ -87,7 +91,8 @@ export default class IssuableForm { ...@@ -87,7 +91,8 @@ export default class IssuableForm {
} }
initAutosave() { initAutosave() {
const searchTerm = format(document.location.search); const { search } = document.location;
const searchTerm = format(search);
const fallbackKey = getFallbackKey(); const fallbackKey = getFallbackKey();
this.autosave = new Autosave( this.autosave = new Autosave(
......
---
title: Avoid pre-populating form for MR resolve issues
merge_request: 22593
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment