diff options
author | Lee Tickett <lee@tickett.net> | 2019-09-03 22:10:08 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-09-03 22:10:08 +0300 |
commit | 19371b9062664ccb75f61825da1924187750a6a9 (patch) | |
tree | e1f2e4e17dbb73659c83f7b9e268a321eb3780fa /app/assets/javascripts | |
parent | 5256f011834ae020f1957ae56e48b7bb57cafb0f (diff) |
Revert "DB change, migratoin and changelog"
This reverts commit af5242ecb682189c5d8276e1ab1ffe5ce844f2e5.
Diffstat (limited to 'app/assets/javascripts')
3 files changed, 22 insertions, 41 deletions
diff --git a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue index c6cc04a139f..ce592720531 100644 --- a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue +++ b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue @@ -67,18 +67,14 @@ export default { saveAssignees() { this.loading = true; - function setLoadingFalse() { - this.loading = false; - } - this.mediator .saveAssignees(this.field) - .then(setLoadingFalse.bind(this)) .then(() => { + this.loading = false; refreshUserMergeRequestCounts(); }) .catch(() => { - setLoadingFalse(); + this.loading = false; return new Flash(__('Error occurred when saving assignees')); }); }, diff --git a/app/assets/javascripts/sidebar/services/sidebar_service.js b/app/assets/javascripts/sidebar/services/sidebar_service.js index cbe20f761ff..feb08e3acaf 100644 --- a/app/assets/javascripts/sidebar/services/sidebar_service.js +++ b/app/assets/javascripts/sidebar/services/sidebar_service.js @@ -1,7 +1,4 @@ -import Vue from 'vue'; -import VueResource from 'vue-resource'; - -Vue.use(VueResource); +import axios from '~/lib/utils/axios_utils'; export default class SidebarService { constructor(endpointMap) { @@ -18,23 +15,15 @@ export default class SidebarService { } get() { - return Vue.http.get(this.endpoint); + return axios.get(this.endpoint); } update(key, data) { - return Vue.http.put( - this.endpoint, - { - [key]: data, - }, - { - emulateJSON: true, - }, - ); + return axios.put(this.endpoint, { [key]: data }); } getProjectsAutocomplete(searchTerm) { - return Vue.http.get(this.projectsAutocompleteEndpoint, { + return axios.get(this.projectsAutocompleteEndpoint, { params: { search: searchTerm, }, @@ -42,11 +31,11 @@ export default class SidebarService { } toggleSubscription() { - return Vue.http.post(this.toggleSubscriptionEndpoint); + return axios.post(this.toggleSubscriptionEndpoint); } moveIssue(moveToProjectId) { - return Vue.http.post(this.moveIssueEndpoint, { + return axios.post(this.moveIssueEndpoint, { move_to_project_id: moveToProjectId, }); } diff --git a/app/assets/javascripts/sidebar/sidebar_mediator.js b/app/assets/javascripts/sidebar/sidebar_mediator.js index 643fe6c00b6..4a7000cbbda 100644 --- a/app/assets/javascripts/sidebar/sidebar_mediator.js +++ b/app/assets/javascripts/sidebar/sidebar_mediator.js @@ -32,7 +32,10 @@ export default class SidebarMediator { // If there are no ids, that means we have to unassign (which is id = 0) // And it only accepts an array, hence [0] - return this.service.update(field, selected.length === 0 ? [0] : selected); + const assignees = selected.length === 0 ? [0] : selected; + const data = { assignee_ids: assignees }; + + return this.service.update(field, data); } setMoveToProjectId(projectId) { @@ -42,8 +45,7 @@ export default class SidebarMediator { fetch() { return this.service .get() - .then(response => response.json()) - .then(data => { + .then(({ data }) => { this.processFetchedData(data); }) .catch(() => new Flash(__('Error occurred when fetching sidebar data'))); @@ -71,23 +73,17 @@ export default class SidebarMediator { } fetchAutocompleteProjects(searchTerm) { - return this.service - .getProjectsAutocomplete(searchTerm) - .then(response => response.json()) - .then(data => { - this.store.setAutocompleteProjects(data); - return this.store.autocompleteProjects; - }); + return this.service.getProjectsAutocomplete(searchTerm).then(({ data }) => { + this.store.setAutocompleteProjects(data); + return this.store.autocompleteProjects; + }); } moveIssue() { - return this.service - .moveIssue(this.store.moveToProjectId) - .then(response => response.json()) - .then(data => { - if (window.location.pathname !== data.web_url) { - visitUrl(data.web_url); - } - }); + return this.service.moveIssue(this.store.moveToProjectId).then(({ data }) => { + if (window.location.pathname !== data.web_url) { + visitUrl(data.web_url); + } + }); } } |