Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8498f4fa
Commit
8498f4fa
authored
Dec 12, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix successful rebase throwing flash error message
Fix
https://gitlab.com/gitlab-org/gitlab-ee/issues/4304
parent
865c9ad5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
24 deletions
+69
-24
changelogs/unreleased-ee/4304-fix-successful-rebase.yml
changelogs/unreleased-ee/4304-fix-successful-rebase.yml
+5
-0
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
...rge_request_widget/components/states/mr_widget_rebase.vue
+25
-24
spec/javascripts/vue_mr_widget/components/mr_widget_rebase_spec.js
...scripts/vue_mr_widget/components/mr_widget_rebase_spec.js
+39
-0
No files found.
changelogs/unreleased-ee/4304-fix-successful-rebase.yml
0 → 100644
View file @
8498f4fa
---
title
:
Fix successful rebase throwing flash error message
merge_request
:
3727
author
:
type
:
fixed
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
View file @
8498f4fa
...
...
@@ -50,30 +50,7 @@
this
.
service
.
rebase
()
.
then
(()
=>
{
simplePoll
((
continuePolling
,
stopPolling
)
=>
{
this
.
service
.
poll
()
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
if
(
res
.
rebase_in_progress
)
{
continuePolling
();
}
else
{
this
.
isMakingRequest
=
false
;
if
(
res
.
merge_error
.
length
)
{
this
.
rebasingError
=
res
.
merge_error
;
Flash
(
'
Something went wrong. Please try again.
'
);
}
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
stopPolling
();
}
})
.
catch
(()
=>
{
this
.
isMakingRequest
=
false
;
Flash
(
'
Something went wrong. Please try again.
'
);
stopPolling
();
});
});
simplePoll
(
this
.
checkRebaseStatus
);
})
.
catch
((
error
)
=>
{
this
.
rebasingError
=
error
.
merge_error
;
...
...
@@ -81,6 +58,30 @@
Flash
(
'
Something went wrong. Please try again.
'
);
});
},
checkRebaseStatus
(
continuePolling
,
stopPolling
)
{
this
.
service
.
poll
()
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
if
(
res
.
rebase_in_progress
)
{
continuePolling
();
}
else
{
this
.
isMakingRequest
=
false
;
if
(
res
.
merge_error
&&
res
.
merge_error
.
length
)
{
this
.
rebasingError
=
res
.
merge_error
;
Flash
(
'
Something went wrong. Please try again.
'
);
}
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
stopPolling
();
}
})
.
catch
(()
=>
{
this
.
isMakingRequest
=
false
;
Flash
(
'
Something went wrong. Please try again.
'
);
stopPolling
();
});
},
},
};
</
script
>
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_rebase_spec.js
View file @
8498f4fa
import
Vue
from
'
vue
'
;
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
component
from
'
ee/vue_merge_request_widget/components/states/mr_widget_rebase.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
...
...
@@ -75,4 +76,42 @@ describe('Merge request widget rebase component', () => {
expect
(
text
).
toContain
(
'
to allow this merge request to be merged.
'
);
});
});
describe
(
'
methods
'
,
()
=>
{
it
(
'
checkRebaseStatus
'
,
(
done
)
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
mountComponent
(
Component
,
{
mr
:
{},
service
:
{
rebase
()
{
return
Promise
.
resolve
();
},
poll
()
{
return
Promise
.
resolve
({
json
()
{
return
{
rebase_in_progress
:
false
,
merge_error
:
null
,
};
},
});
},
},
});
vm
.
rebase
();
// Wait for the rebase request
vm
.
$nextTick
()
// Wait for the polling request
.
then
(
vm
.
$nextTick
())
// Wait for the eventHub to be called
.
then
(
vm
.
$nextTick
())
.
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
MRWidgetUpdateRequested
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
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