Skip to content
Snippets Groups Projects

Merge branch '399096-remove-unused-learn-gitlab-commit-tracking' into 'master'

Remove unused tracking

See merge request !116005



Merged-by: default avatarSerhii Yarynovskyi <syarynovskyi@gitlab.com>
Approved-by: default avatarElwyn Benson <ebenson@gitlab.com>
Approved-by: Andrew Fontaine's avatarAndrew Fontaine <afontaine@gitlab.com>
Approved-by: default avatarSam Kim <skim@gitlab.com>
Reviewed-by: default avatarLin Jen-Shin <jen-shin@gitlab.com>
parents e4cda0eb 7ae7100a
No related branches found
No related tags found
No related merge requests found
Pipeline #822881726 passed with warnings
Pipeline: GitLab

#822907332

    Pipeline: GitLab

    #822896377

      ......@@ -72,7 +72,6 @@ export const initLegacyWebIDE = (el, options = {}) => {
      environmentsGuidanceAlertDismissed: !parseBoolean(el.dataset.enableEnvironmentsGuidance),
      previewMarkdownPath: el.dataset.previewMarkdownPath,
      userPreferencesPath: el.dataset.userPreferencesPath,
      learnGitlabSource: parseBoolean(el.dataset.learnGitlabSource),
      });
      },
      beforeDestroy() {
      ......
      import { createAlert } from '~/alert';
      import { addNumericSuffix } from '~/ide/utils';
      import { sprintf, __ } from '~/locale';
      import Tracking from '~/tracking';
      import { leftSidebarViews } from '../../../constants';
      import eventHub from '../../../eventhub';
      import { parseCommitError } from '../../../lib/errors';
      ......@@ -163,10 +162,6 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
      );
      }
      if (rootState.learnGitlabSource) {
      Tracking.event(undefined, 'commit', { label: 'web_ide_learn_gitlab_source' });
      }
      dispatch('setLastCommitMessage', data);
      dispatch('updateCommitMessage', '');
      return dispatch('updateFilesAfterCommit', {
      ......
      ......@@ -32,5 +32,4 @@ export default () => ({
      environmentsGuidanceAlertDetected: false,
      previewMarkdownPath: '',
      userPreferencesPath: '',
      learnGitlabSource: false,
      });
      ......@@ -83,5 +83,3 @@ def has_dismissed_ide_environments_callout?
      current_user.dismissed_callout?(feature_name: 'web_ide_ci_environments_guidance')
      end
      end
      IdeHelper.prepend_mod_with('IdeHelper')
      # frozen_string_literal: true
      module EE
      module IdeHelper
      extend ::Gitlab::Utils::Override
      override :ide_data
      def ide_data(project:, fork_info:, params:)
      super.merge(
      'learn_gitlab_source' => ::Gitlab::Utils.to_boolean(params[:learn_gitlab_source]).to_s
      )
      end
      end
      end
      ......@@ -47,7 +47,7 @@ def onboarding_actions_data(project)
      end
      data[:code_added] = {
      url: CGI.unescape(ide_project_edit_path(project.full_path, learn_gitlab_source: true)),
      url: CGI.unescape(ide_project_edit_path(project.full_path)),
      completed: onboarding_completion.completed?(:code_added),
      enabled: true
      }
      ......
      # frozen_string_literal: true
      require 'spec_helper'
      RSpec.describe IdeHelper, feature_category: :web_ide do
      describe '#ide_data' do
      let_it_be(:user) { build(:user) }
      let(:params) { { learn_gitlab_source: true } }
      before do
      allow(helper).to receive(:current_user).and_return(user)
      end
      it 'returns hash' do
      expect(helper.ide_data(project: nil, fork_info: nil, params: params))
      .to include('learn_gitlab_source' => 'true')
      end
      context 'when false source' do
      let(:params) { { learn_gitlab_source: false } }
      it 'returns hash' do
      expect(helper.ide_data(project: nil, fork_info: nil, params: params))
      .to include('learn_gitlab_source' => 'false')
      end
      end
      context 'when random source' do
      let(:params) { { learn_gitlab_source: 'random' } }
      it 'returns hash' do
      expect(helper.ide_data(project: nil, fork_info: nil, params: params))
      .to include('learn_gitlab_source' => '')
      end
      end
      context 'when no source' do
      let(:params) { {} }
      it 'returns hash' do
      expect(helper.ide_data(project: nil, fork_info: nil, params: params))
      .to include('learn_gitlab_source' => '')
      end
      end
      end
      end
      ......@@ -83,7 +83,7 @@
      git_write: a_hash_including(url: %r{/#{project.name}\z}),
      user_added: a_hash_including(url: %r{#\z}),
      merge_request_created: a_hash_including(url: %r{/#{project.name}/-/merge_requests\z}),
      code_added: a_hash_including(url: %r{/-/ide/project/#{project.full_path}/edit\?learn_gitlab_source=true\z}),
      code_added: a_hash_including(url: %r{/-/ide/project/#{project.full_path}/edit\z}),
      code_owners_enabled: a_hash_including(url: %r{/user/project/code_owners#set-up-code-owners\z}),
      required_mr_approvals_enabled: a_hash_including(
      url: %r{/ci/pipelines/settings#coverage-check-approval-rule\z}
      ......
      import axios from 'axios';
      import MockAdapter from 'axios-mock-adapter';
      import testAction from 'helpers/vuex_action_helper';
      import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
      import { file } from 'jest/ide/helpers';
      import { commitActionTypes, PERMISSION_CREATE_MR } from '~/ide/constants';
      import eventHub from '~/ide/eventhub';
      ......@@ -40,14 +39,12 @@ describe('IDE commit module actions', () => {
      let mock;
      let store;
      let router;
      let trackingSpy;
      beforeEach(() => {
      store = createStore();
      router = createRouter(store);
      gon.api_version = 'v1';
      mock = new MockAdapter(axios);
      trackingSpy = mockTracking(undefined, undefined, jest.spyOn);
      jest.spyOn(router, 'push').mockImplementation();
      mock
      ......@@ -56,7 +53,6 @@ describe('IDE commit module actions', () => {
      });
      afterEach(() => {
      unmockTracking();
      mock.restore();
      });
      ......@@ -426,28 +422,6 @@ describe('IDE commit module actions', () => {
      });
      });
      });
      describe('learnGitlabSource', () => {
      describe('learnGitlabSource is true', () => {
      it('tracks commit', async () => {
      store.state.learnGitlabSource = true;
      await store.dispatch('commit/commitChanges');
      expect(trackingSpy).toHaveBeenCalledWith(undefined, 'commit', {
      label: 'web_ide_learn_gitlab_source',
      });
      });
      });
      describe('learnGitlabSource is false', () => {
      it('does not track commit', async () => {
      await store.dispatch('commit/commitChanges');
      expect(trackingSpy).not.toHaveBeenCalled();
      });
      });
      });
      });
      describe('success response with failed message', () => {
      ......@@ -465,26 +439,6 @@ describe('IDE commit module actions', () => {
      expect(alert.textContent.trim()).toBe('failed message');
      });
      describe('learnGitlabSource', () => {
      describe('learnGitlabSource is true', () => {
      it('does not track commit', async () => {
      store.state.learnGitlabSource = true;
      await store.dispatch('commit/commitChanges');
      expect(trackingSpy).not.toHaveBeenCalled();
      });
      });
      describe('learnGitlabSource is false', () => {
      it('does not track commit', async () => {
      await store.dispatch('commit/commitChanges');
      expect(trackingSpy).not.toHaveBeenCalled();
      });
      });
      });
      });
      describe('failed response', () => {
      ......@@ -504,26 +458,6 @@ describe('IDE commit module actions', () => {
      ['commit/SET_ERROR', createUnexpectedCommitError(), undefined],
      ]);
      });
      describe('learnGitlabSource', () => {
      describe('learnGitlabSource is true', () => {
      it('does not track commit', async () => {
      store.state.learnGitlabSource = true;
      await store.dispatch('commit/commitChanges').catch(() => {});
      expect(trackingSpy).not.toHaveBeenCalled();
      });
      });
      describe('learnGitlabSource is false', () => {
      it('does not track commit', async () => {
      await store.dispatch('commit/commitChanges').catch(() => {});
      expect(trackingSpy).not.toHaveBeenCalled();
      });
      });
      });
      });
      describe('first commit of a branch', () => {
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment