CE backport of issue-boards-js-fix

This commit is contained in:
Phil Hughes 2018-07-25 16:38:43 +01:00
parent 3f14c56bfe
commit 2f8b9931bc
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
1 changed files with 76 additions and 73 deletions

View File

@ -1,5 +1,3 @@
/* eslint-disable quote-props, comma-dangle */
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import Vue from 'vue'; import Vue from 'vue';
@ -47,7 +45,7 @@ export default () => {
gl.IssueBoardsApp = new Vue({ gl.IssueBoardsApp = new Vue({
el: $boardApp, el: $boardApp,
components: { components: {
'board': gl.issueBoards.Board, board: gl.issueBoards.Board,
'board-sidebar': gl.issueBoards.BoardSidebar, 'board-sidebar': gl.issueBoards.BoardSidebar,
BoardAddIssuesModal, BoardAddIssuesModal,
}, },
@ -94,10 +92,11 @@ export default () => {
this.filterManager.setup(); this.filterManager.setup();
Store.disabled = this.disabled; Store.disabled = this.disabled;
gl.boardService.all() gl.boardService
.all()
.then(res => res.data) .then(res => res.data)
.then((data) => { .then(data => {
data.forEach((board) => { data.forEach(board => {
const list = Store.addList(board, this.defaultAvatar); const list = Store.addList(board, this.defaultAvatar);
if (list.type === 'closed') { if (list.type === 'closed') {
@ -126,7 +125,7 @@ export default () => {
newIssue.setFetchingState('subscriptions', true); newIssue.setFetchingState('subscriptions', true);
BoardService.getIssueInfo(sidebarInfoEndpoint) BoardService.getIssueInfo(sidebarInfoEndpoint)
.then(res => res.data) .then(res => res.data)
.then((data) => { .then(data => {
newIssue.setFetchingState('subscriptions', false); newIssue.setFetchingState('subscriptions', false);
newIssue.updateData({ newIssue.updateData({
subscribed: data.subscribed, subscribed: data.subscribed,
@ -159,7 +158,7 @@ export default () => {
Flash(__('An error occurred when toggling the notification subscription')); Flash(__('An error occurred when toggling the notification subscription'));
}); });
} }
} },
}, },
}); });
@ -173,8 +172,11 @@ export default () => {
}, },
}); });
const issueBoardsModal = document.getElementById('js-add-issues-btn');
if (issueBoardsModal) {
gl.IssueBoardsModalAddBtn = new Vue({ gl.IssueBoardsModalAddBtn = new Vue({
el: document.getElementById('js-add-issues-btn'), el: issueBoardsModal,
mixins: [modalMixin], mixins: [modalMixin],
data() { data() {
return { return {
@ -241,4 +243,5 @@ export default () => {
</div> </div>
`, `,
}); });
}
}; };