Commit 23bd46cf authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Fatih Acet

Remove applySuggestion from notes service

parent c0e193db
import Vue from 'vue'; import Vue from 'vue';
import Api from '~/api';
import VueResource from 'vue-resource'; import VueResource from 'vue-resource';
import * as constants from '../constants'; import * as constants from '../constants';
...@@ -45,7 +44,4 @@ export default { ...@@ -45,7 +44,4 @@ export default {
toggleIssueState(endpoint, data) { toggleIssueState(endpoint, data) {
return Vue.http.put(endpoint, data); return Vue.http.put(endpoint, data);
}, },
applySuggestion(id) {
return Api.applySuggestion(id);
},
}; };
...@@ -14,6 +14,7 @@ import sidebarTimeTrackingEventHub from '../../sidebar/event_hub'; ...@@ -14,6 +14,7 @@ import sidebarTimeTrackingEventHub from '../../sidebar/event_hub';
import { isInViewport, scrollToElement, isInMRPage } from '../../lib/utils/common_utils'; import { isInViewport, scrollToElement, isInMRPage } from '../../lib/utils/common_utils';
import mrWidgetEventHub from '../../vue_merge_request_widget/event_hub'; import mrWidgetEventHub from '../../vue_merge_request_widget/event_hub';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Api from '~/api';
let eTagPoll; let eTagPoll;
...@@ -449,8 +450,7 @@ export const submitSuggestion = ( ...@@ -449,8 +450,7 @@ export const submitSuggestion = (
{ commit, dispatch }, { commit, dispatch },
{ discussionId, noteId, suggestionId, flashContainer }, { discussionId, noteId, suggestionId, flashContainer },
) => ) =>
service Api.applySuggestion(suggestionId)
.applySuggestion(suggestionId)
.then(() => commit(types.APPLY_SUGGESTION, { discussionId, noteId, suggestionId })) .then(() => commit(types.APPLY_SUGGESTION, { discussionId, noteId, suggestionId }))
.then(() => dispatch('resolveDiscussion', { discussionId }).catch(() => {})) .then(() => dispatch('resolveDiscussion', { discussionId }).catch(() => {}))
.catch(err => { .catch(err => {
......
---
title: Remove applySuggestion from notes service
merge_request: 30399
author: Frank van Rest
type: other
import Vue from 'vue'; import Vue from 'vue';
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import Api from '~/api';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import { headersInterceptor } from 'spec/helpers/vue_resource_helper'; import { headersInterceptor } from 'spec/helpers/vue_resource_helper';
import actionsModule, * as actions from '~/notes/stores/actions'; import actionsModule, * as actions from '~/notes/stores/actions';
...@@ -8,7 +9,6 @@ import * as mutationTypes from '~/notes/stores/mutation_types'; ...@@ -8,7 +9,6 @@ import * as mutationTypes from '~/notes/stores/mutation_types';
import * as notesConstants from '~/notes/constants'; import * as notesConstants from '~/notes/constants';
import createStore from '~/notes/stores'; import createStore from '~/notes/stores';
import mrWidgetEventHub from '~/vue_merge_request_widget/event_hub'; import mrWidgetEventHub from '~/vue_merge_request_widget/event_hub';
import service from '~/notes/services/notes_service';
import testAction from '../../helpers/vuex_action_helper'; import testAction from '../../helpers/vuex_action_helper';
import { resetStore } from '../helpers'; import { resetStore } from '../helpers';
import { import {
...@@ -846,9 +846,9 @@ describe('Actions Notes Store', () => { ...@@ -846,9 +846,9 @@ describe('Actions Notes Store', () => {
let flashContainer; let flashContainer;
beforeEach(() => { beforeEach(() => {
spyOn(service, 'applySuggestion'); spyOn(Api, 'applySuggestion');
dispatch.and.returnValue(Promise.resolve()); dispatch.and.returnValue(Promise.resolve());
service.applySuggestion.and.returnValue(Promise.resolve()); Api.applySuggestion.and.returnValue(Promise.resolve());
flashContainer = {}; flashContainer = {};
}); });
...@@ -877,7 +877,7 @@ describe('Actions Notes Store', () => { ...@@ -877,7 +877,7 @@ describe('Actions Notes Store', () => {
it('when service fails, flashes error message', done => { it('when service fails, flashes error message', done => {
const response = { response: { data: { message: TEST_ERROR_MESSAGE } } }; const response = { response: { data: { message: TEST_ERROR_MESSAGE } } };
service.applySuggestion.and.returnValue(Promise.reject(response)); Api.applySuggestion.and.returnValue(Promise.reject(response));
testSubmitSuggestion(done, () => { testSubmitSuggestion(done, () => {
expect(commit).not.toHaveBeenCalled(); expect(commit).not.toHaveBeenCalled();
......
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