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:
Diffstat (limited to 'app/assets/javascripts/issuable/issuable_form.js')
-rw-r--r--app/assets/javascripts/issuable/issuable_form.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/assets/javascripts/issuable/issuable_form.js b/app/assets/javascripts/issuable/issuable_form.js
index a1525ad2bec..1c1acddb90b 100644
--- a/app/assets/javascripts/issuable/issuable_form.js
+++ b/app/assets/javascripts/issuable/issuable_form.js
@@ -7,6 +7,9 @@ import { queryToObject, objectToQuery } from '~/lib/utils/url_utility';
import UsersSelect from '~/users_select';
import ZenMode from '~/zen_mode';
import { containsSensitiveToken, confirmSensitiveAction, i18n } from '~/lib/utils/secret_detection';
+import { trackSavedUsingEditor } from '~/vue_shared/components/markdown/tracking';
+import { EDITING_MODE_CONTENT_EDITOR } from '~/vue_shared/constants';
+import { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE } from '~/notes/constants';
const MR_SOURCE_BRANCH = 'merge_request[source_branch]';
const MR_TARGET_BRANCH = 'merge_request[target_branch]';
@@ -47,6 +50,13 @@ function getFallbackKey() {
return ['autosave', document.location.pathname, searchTerm].join('/');
}
+function getIssuableType() {
+ if (document.location.pathname.includes('merge_requests')) return MERGE_REQUEST_NOTEABLE_TYPE;
+ if (document.location.pathname.includes('issues')) return ISSUE_NOTEABLE_TYPE;
+ // eslint-disable-next-line @gitlab/require-i18n-strings
+ return 'Other';
+}
+
export default class IssuableForm {
static addAutosave(map, id, element, searchTerm, fallbackKey) {
if (!element) return;
@@ -144,6 +154,11 @@ export default class IssuableForm {
async handleSubmit(event) {
event.preventDefault();
+ trackSavedUsingEditor(
+ localStorage.getItem('gl-markdown-editor-mode') === EDITING_MODE_CONTENT_EDITOR,
+ getIssuableType(),
+ );
+
const form = event.target;
const descriptionText = this.descriptionField().val();