Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-07 12:12:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-07 12:12:12 +0300
commitb9bc4d88ea6b998e2cede0da904f36daa2c18007 (patch)
tree46a3d43aa85d18f1fe27cfccdad9e7cf53fda14f /app/assets/javascripts/issuable
parent913224e81c5ee474f2d61962fed3c7e42b71c3f9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/issuable')
-rw-r--r--app/assets/javascripts/issuable/issuable_form.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/assets/javascripts/issuable/issuable_form.js b/app/assets/javascripts/issuable/issuable_form.js
index cc2608b5c62..4c6685820cf 100644
--- a/app/assets/javascripts/issuable/issuable_form.js
+++ b/app/assets/javascripts/issuable/issuable_form.js
@@ -39,6 +39,11 @@ function format(searchTerm, isFallbackKey = false) {
return formattedQuery;
}
+function getSearchTerm(newIssuePath) {
+ const { search, pathname } = document.location;
+ return newIssuePath === pathname ? '' : format(search);
+}
+
function getFallbackKey() {
const searchTerm = format(document.location.search, true);
return ['autosave', document.location.pathname, searchTerm].join('/');
@@ -72,7 +77,8 @@ export default class IssuableForm {
this.reviewersSelect = new UsersSelect(undefined, '.js-reviewer-search');
this.zenMode = new ZenMode();
- this.newIssuePath = form[0].getAttribute(DATA_ISSUES_NEW_PATH);
+ this.searchTerm = getSearchTerm(form[0].getAttribute(DATA_ISSUES_NEW_PATH));
+ this.fallbackKey = getFallbackKey();
this.titleField = this.form.find('input[name*="[title]"]');
this.descriptionField = this.form.find('textarea[name*="[description]"]');
if (!(this.titleField.length && this.descriptionField.length)) {
@@ -109,20 +115,16 @@ export default class IssuableForm {
}
initAutosave() {
- const { search, pathname } = document.location;
- const searchTerm = this.newIssuePath === pathname ? '' : format(search);
- const fallbackKey = getFallbackKey();
-
- this.autosave = new Autosave(
+ this.autosaveTitle = new Autosave(
this.titleField,
- [document.location.pathname, searchTerm, 'title'],
- `${fallbackKey}=title`,
+ [document.location.pathname, this.searchTerm, 'title'],
+ `${this.fallbackKey}=title`,
);
- return new Autosave(
+ this.autosaveDescription = new Autosave(
this.descriptionField,
- [document.location.pathname, searchTerm, 'description'],
- `${fallbackKey}=description`,
+ [document.location.pathname, this.searchTerm, 'description'],
+ `${this.fallbackKey}=description`,
);
}
@@ -131,8 +133,8 @@ export default class IssuableForm {
}
resetAutosave() {
- this.titleField.data('autosave').reset();
- return this.descriptionField.data('autosave').reset();
+ this.autosaveTitle.reset();
+ this.autosaveDescription.reset();
}
initWip() {