diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-01-16 14:56:01 +0300 |
---|---|---|
committer | Luke Bennett <lukeeeebennettplus@gmail.com> | 2018-01-17 19:27:51 +0300 |
commit | f1b9a9cb28209d5cacd0e7a4b9132dab7900dcf7 (patch) | |
tree | ccbeb9910221f40bb2acb9b632f222a62f0e4cb2 /app | |
parent | 6fefbf2e4b8e388470cfa8bb4eb7079817f85a5c (diff) |
Merge branch 'mr-status-box-update' into 'master'
Fixed merge request status badge not updating after merging
See merge request gitlab-org/gitlab-ce!16470
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 088f4921bf4..5384872acb7 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -111,7 +111,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() { }); }; -MergeRequest.setStatusBoxToMerged = function() { +MergeRequest.updateStatusText = function(classToRemove, classToAdd, newStatusText) { $('.detail-page-header .status-box') .removeClass('status-box-open') .addClass('status-box-mr-merged') @@ -119,14 +119,14 @@ MergeRequest.setStatusBoxToMerged = function() { .text(__('Merged')); }; -MergeRequest.prototype.decreaseCounter = function(by = 1) { - const $el = $('.nav-links .js-merge-counter'); +MergeRequest.decreaseCounter = function(by = 1) { + const $el = $('.js-merge-counter'); const count = Math.max((parseInt($el.text().replace(/[^\d]/, ''), 10) - by), 0); $el.text(addDelimiter(count)); }; -MergeRequest.prototype.hideCloseButton = function() { +MergeRequest.hideCloseButton = function() { const el = document.querySelector('.merge-request .js-issuable-actions'); const closeDropdownItem = el.querySelector('li.close-item'); if (closeDropdownItem) { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js index c0761f63098..60f42c46ffe 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js @@ -1,6 +1,7 @@ import successSvg from 'icons/_icon_status_success.svg'; import warningSvg from 'icons/_icon_status_warning.svg'; import simplePoll from '~/lib/utils/simple_poll'; +import MergeRequest from '../../../merge_request'; import Flash from '../../../flash'; import statusIcon from '../mr_widget_status_icon'; import eventHub from '../../event_hub'; @@ -165,7 +166,7 @@ export default { // If state is merged we should update the widget and stop the polling eventHub.$emit('MRWidgetUpdateRequested'); eventHub.$emit('FetchActionsContent'); - MergeRequest.setStatusBoxToMerged(); + MergeRequest.updateStatusText('status-box-open', 'status-box-merged', 'Merged'); MergeRequest.hideCloseButton(); MergeRequest.decreaseCounter(); stopPolling(); |