diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-03 17:00:59 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-07 14:57:28 +0100 |
commit | 55dd0d722d87a24f3b83a8a7692666a64387d668 (patch) | |
tree | 673d318330c0ca8d14b0147d74707a87686ebddf /app/assets/javascripts/merge_request.js | |
parent | b8deafd0d8eacb5cbba9e868c445c92b514d537e (diff) | |
download | gitlab-ce-55dd0d722d87a24f3b83a8a7692666a64387d668.tar.gz |
Dont show toggle if only one action is available and do not show report as abuse for current_user's issuables
Diffstat (limited to 'app/assets/javascripts/merge_request.js')
-rw-r--r-- | app/assets/javascripts/merge_request.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 412d68dc37a..cae2f290f87 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -22,10 +22,12 @@ import CloseReopenReportToggle from './close_reopen_report_toggle'; return _this.showAllCommits(); }; })(this)); + this.initTabs(); this.initMRBtnListeners(); this.initCommitMessageListeners(); - MergeRequest.initCloseReopenReport(); + this.initCloseReopenReport(); + if ($("a.btn-close").length) { this.taskList = new gl.TaskList({ dataType: 'merge_request', @@ -66,11 +68,15 @@ import CloseReopenReportToggle from './close_reopen_report_toggle'; if (shouldSubmit && $this.data('submitted')) { return; } + + _this.disableCloseReopenButton($this, true); + if (shouldSubmit) { if ($this.hasClass('btn-comment-and-close') || $this.hasClass('btn-comment-and-reopen')) { e.preventDefault(); e.stopImmediatePropagation(); - return _this.submitNoteForm($this.closest('form'), $this); + + _this.submitNoteForm($this.closest('form'), $this); } } }); @@ -121,7 +127,7 @@ import CloseReopenReportToggle from './close_reopen_report_toggle'; $el.text(gl.text.addDelimiter(count)); }; - MergeRequest.initCloseReopenReport = function () { + MergeRequest.prototype.initCloseReopenReport = function () { const container = document.querySelector('.js-issuable-close-dropdown'); if (!container) return; @@ -130,13 +136,21 @@ import CloseReopenReportToggle from './close_reopen_report_toggle'; const dropdownList = container.querySelector('.js-issuable-close-menu'); const button = container.querySelector('.js-issuable-close-button'); - const closeReopenReportToggle = new CloseReopenReportToggle({ + this.closeReopenReportToggle = new CloseReopenReportToggle({ dropdownTrigger, dropdownList, button, }); - closeReopenReportToggle.initDroplab(); + this.closeReopenReportToggle.initDroplab(); + }; + + MergeRequest.prototype.disableCloseReopenButton = function ($button, shouldDisable) { + if (this.closeReopenReportToggle) { + this.closeReopenReportToggle.setDisable(shouldDisable); + } else { + $button.prop('disabled', shouldDisable); + } }; return MergeRequest; |