BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
05cedf5b
Commit
05cedf5b
authored
Jan 16, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain 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
parents
b94b8aae
73dc529b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
13 deletions
+61
-13
merge_request.js
app/assets/javascripts/merge_request.js
+4
-4
mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+4
-5
mr-status-box-update.yml
changelogs/unreleased/mr-status-box-update.yml
+5
-0
merge_request_spec.js
spec/javascripts/merge_request_spec.js
+3
-4
mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+45
-0
No files found.
app/assets/javascripts/merge_request.js
View file @
05cedf5b
...
...
@@ -110,7 +110,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
});
};
MergeRequest
.
prototype
.
updateStatusText
=
function
(
classToRemove
,
classToAdd
,
newStatusText
)
{
MergeRequest
.
updateStatusText
=
function
(
classToRemove
,
classToAdd
,
newStatusText
)
{
$
(
'.detail-page-header .status-box'
)
.
removeClass
(
classToRemove
)
.
addClass
(
classToAdd
)
...
...
@@ -118,14 +118,14 @@ MergeRequest.prototype.updateStatusText = function(classToRemove, classToAdd, ne
.
text
(
newStatusText
);
};
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
)
{
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
05cedf5b
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,11 +166,9 @@ export default {
// If state is merged we should update the widget and stop the polling
eventHub
.
$emit
(
'MRWidgetUpdateRequested'
);
eventHub
.
$emit
(
'FetchActionsContent'
);
if
(
window
.
mergeRequest
)
{
window
.
mergeRequest
.
updateStatusText
(
'status-box-open'
,
'status-box-merged'
,
'Merged'
);
window
.
mergeRequest
.
hideCloseButton
();
window
.
mergeRequest
.
decreaseCounter
();
}
MergeRequest
.
updateStatusText
(
'status-box-open'
,
'status-box-merged'
,
'Merged'
);
MergeRequest
.
hideCloseButton
();
MergeRequest
.
decreaseCounter
();
stopPolling
();
// If user checked remove source branch and we didn't remove the branch yet
...
...
changelogs/unreleased/mr-status-box-update.yml
0 → 100644
View file @
05cedf5b
---
title
:
Fixed merge request status badge not updating after merging
merge_request
:
author
:
type
:
fixed
spec/javascripts/merge_request_spec.js
View file @
05cedf5b
...
...
@@ -70,8 +70,8 @@ import IssuablesHelper from '~/helpers/issuables_helper';
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/merge_request_with_task_list.html.raw'
);
this
.
el
=
document
.
querySelector
(
'.js-issuable-actions'
);
const
merge
=
new
MergeRequest
();
merge
.
hideCloseButton
();
new
MergeRequest
();
// eslint-disable-line no-new
MergeRequest
.
hideCloseButton
();
});
it
(
'hides the dropdown close item and selects the next item'
,
()
=>
{
...
...
@@ -90,8 +90,7 @@ import IssuablesHelper from '~/helpers/issuables_helper';
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/merge_request_of_current_user.html.raw'
);
this
.
el
=
document
.
querySelector
(
'.js-issuable-actions'
);
const
merge
=
new
MergeRequest
();
merge
.
hideCloseButton
();
MergeRequest
.
hideCloseButton
();
});
it
(
'hides the close button'
,
()
=>
{
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
05cedf5b
...
...
@@ -371,6 +371,10 @@ describe('MRWidgetReadyToMerge', () => {
});
});
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/merge_request_of_current_user.html.raw'
);
});
it
(
'should call start and stop polling when MR merged'
,
(
done
)
=>
{
spyOn
(
eventHub
,
'$emit'
);
spyOn
(
vm
.
service
,
'poll'
).
and
.
returnValue
(
returnPromise
(
'merged'
));
...
...
@@ -392,6 +396,47 @@ describe('MRWidgetReadyToMerge', () => {
},
333
);
});
it
(
'updates status box'
,
(
done
)
=>
{
spyOn
(
vm
.
service
,
'poll'
).
and
.
returnValue
(
returnPromise
(
'merged'
));
spyOn
(
vm
,
'initiateRemoveSourceBranchPolling'
);
vm
.
handleMergePolling
(()
=>
{},
()
=>
{});
setTimeout
(()
=>
{
const
statusBox
=
document
.
querySelector
(
'.status-box'
);
expect
(
statusBox
.
classList
.
contains
(
'status-box-merged'
)).
toBeTruthy
();
expect
(
statusBox
.
textContent
).
toContain
(
'Merged'
);
done
();
});
});
it
(
'hides close button'
,
(
done
)
=>
{
spyOn
(
vm
.
service
,
'poll'
).
and
.
returnValue
(
returnPromise
(
'merged'
));
spyOn
(
vm
,
'initiateRemoveSourceBranchPolling'
);
vm
.
handleMergePolling
(()
=>
{},
()
=>
{});
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'.btn-close'
).
classList
.
contains
(
'hidden'
)).
toBeTruthy
();
done
();
});
});
it
(
'updates merge request count badge'
,
(
done
)
=>
{
spyOn
(
vm
.
service
,
'poll'
).
and
.
returnValue
(
returnPromise
(
'merged'
));
spyOn
(
vm
,
'initiateRemoveSourceBranchPolling'
);
vm
.
handleMergePolling
(()
=>
{},
()
=>
{});
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'.js-merge-counter'
).
textContent
).
toBe
(
'0'
);
done
();
});
});
it
(
'should continue polling until MR is merged'
,
(
done
)
=>
{
spyOn
(
vm
.
service
,
'poll'
).
and
.
returnValue
(
returnPromise
(
'some_other_state'
));
spyOn
(
vm
,
'initiateRemoveSourceBranchPolling'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment