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
a443acbc
Commit
a443acbc
authored
Dec 14, 2018
by
Sam Bigelow
Committed by
Mike Greiling
Dec 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set cached MRWidget SHA after rebase
parent
111b7465
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
14 deletions
+34
-14
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
...rge_request_widget/components/states/mr_widget_rebase.vue
+1
-1
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
...avascripts/vue_merge_request_widget/mr_widget_options.vue
+6
-2
app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
...ascripts/vue_merge_request_widget/stores/get_state_key.js
+1
-1
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+6
-2
changelogs/unreleased/47052-merge-button-does-not-appear-after-rebase-ing.yml
...d/47052-merge-button-does-not-appear-after-rebase-ing.yml
+5
-0
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+2
-2
spec/javascripts/vue_mr_widget/components/mr_widget_rebase_spec.js
...scripts/vue_mr_widget/components/mr_widget_rebase_spec.js
+1
-1
spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js
spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js
+1
-1
spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
.../javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
+11
-4
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
View file @
a443acbc
...
@@ -72,7 +72,7 @@ export default {
...
@@ -72,7 +72,7 @@ export default {
Flash
(
'
Something went wrong. Please try again.
'
);
Flash
(
'
Something went wrong. Please try again.
'
);
}
}
eventHub
.
$emit
(
'
MRWidget
UpdateRequested
'
);
eventHub
.
$emit
(
'
MRWidget
RebaseSuccess
'
);
stopPolling
();
stopPolling
();
}
}
})
})
...
...
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue
View file @
a443acbc
...
@@ -156,13 +156,13 @@ export default {
...
@@ -156,13 +156,13 @@ export default {
};
};
return
new
MRWidgetService
(
endpoints
);
return
new
MRWidgetService
(
endpoints
);
},
},
checkStatus
(
cb
)
{
checkStatus
(
cb
,
isRebased
)
{
return
this
.
service
return
this
.
service
.
checkStatus
()
.
checkStatus
()
.
then
(
res
=>
res
.
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(
data
=>
{
this
.
handleNotification
(
data
);
this
.
handleNotification
(
data
);
this
.
mr
.
setData
(
data
);
this
.
mr
.
setData
(
data
,
isRebased
);
this
.
setFaviconHelper
();
this
.
setFaviconHelper
();
if
(
cb
)
{
if
(
cb
)
{
...
@@ -264,6 +264,10 @@ export default {
...
@@ -264,6 +264,10 @@ export default {
this
.
checkStatus
(
cb
);
this
.
checkStatus
(
cb
);
});
});
eventHub
.
$on
(
'
MRWidgetRebaseSuccess
'
,
cb
=>
{
this
.
checkStatus
(
cb
,
true
);
});
// `params` should be an Array contains a Boolean, like `[true]`
// `params` should be an Array contains a Boolean, like `[true]`
// Passing parameter as Boolean didn't work.
// Passing parameter as Boolean didn't work.
eventHub
.
$on
(
'
SetBranchRemoveFlag
'
,
params
=>
{
eventHub
.
$on
(
'
SetBranchRemoveFlag
'
,
params
=>
{
...
...
app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
View file @
a443acbc
...
@@ -19,7 +19,7 @@ export default function deviseState(data) {
...
@@ -19,7 +19,7 @@ export default function deviseState(data) {
return
stateKey
.
unresolvedDiscussions
;
return
stateKey
.
unresolvedDiscussions
;
}
else
if
(
this
.
isPipelineBlocked
)
{
}
else
if
(
this
.
isPipelineBlocked
)
{
return
stateKey
.
pipelineBlocked
;
return
stateKey
.
pipelineBlocked
;
}
else
if
(
this
.
hasSHAChanged
)
{
}
else
if
(
this
.
isSHAMismatch
)
{
return
stateKey
.
shaMismatch
;
return
stateKey
.
shaMismatch
;
}
else
if
(
this
.
mergeWhenPipelineSucceeds
)
{
}
else
if
(
this
.
mergeWhenPipelineSucceeds
)
{
return
this
.
mergeError
?
stateKey
.
autoMergeFailed
:
stateKey
.
mergeWhenPipelineSucceeds
;
return
this
.
mergeError
?
stateKey
.
autoMergeFailed
:
stateKey
.
mergeWhenPipelineSucceeds
;
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
a443acbc
...
@@ -11,7 +11,11 @@ export default class MergeRequestStore {
...
@@ -11,7 +11,11 @@ export default class MergeRequestStore {
this
.
setData
(
data
);
this
.
setData
(
data
);
}
}
setData
(
data
)
{
setData
(
data
,
isRebased
)
{
if
(
isRebased
)
{
this
.
sha
=
data
.
diff_head_sha
;
}
const
currentUser
=
data
.
current_user
;
const
currentUser
=
data
.
current_user
;
const
pipelineStatus
=
data
.
pipeline
?
data
.
pipeline
.
details
.
status
:
null
;
const
pipelineStatus
=
data
.
pipeline
?
data
.
pipeline
.
details
.
status
:
null
;
...
@@ -84,7 +88,7 @@ export default class MergeRequestStore {
...
@@ -84,7 +88,7 @@ export default class MergeRequestStore {
this
.
canMerge
=
!!
data
.
merge_path
;
this
.
canMerge
=
!!
data
.
merge_path
;
this
.
canCreateIssue
=
currentUser
.
can_create_issue
||
false
;
this
.
canCreateIssue
=
currentUser
.
can_create_issue
||
false
;
this
.
canCancelAutomaticMerge
=
!!
data
.
cancel_merge_when_pipeline_succeeds_path
;
this
.
canCancelAutomaticMerge
=
!!
data
.
cancel_merge_when_pipeline_succeeds_path
;
this
.
hasSHAChanged
=
this
.
sha
!==
data
.
diff_head_sha
;
this
.
isSHAMismatch
=
this
.
sha
!==
data
.
diff_head_sha
;
this
.
canBeMerged
=
data
.
can_be_merged
||
false
;
this
.
canBeMerged
=
data
.
can_be_merged
||
false
;
this
.
isMergeAllowed
=
data
.
mergeable
||
false
;
this
.
isMergeAllowed
=
data
.
mergeable
||
false
;
this
.
mergeOngoing
=
data
.
merge_ongoing
;
this
.
mergeOngoing
=
data
.
merge_ongoing
;
...
...
changelogs/unreleased/47052-merge-button-does-not-appear-after-rebase-ing.yml
0 → 100644
View file @
a443acbc
---
title
:
Allow merge after rebase without page refresh on FF repositories
merge_request
:
23572
author
:
type
:
fixed
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
a443acbc
...
@@ -27,11 +27,11 @@ export default class MergeRequestStore extends CEMergeRequestStore {
...
@@ -27,11 +27,11 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
licenseManagement
=
data
.
license_management
;
this
.
licenseManagement
=
data
.
license_management
;
}
}
setData
(
data
)
{
setData
(
data
,
isRebased
)
{
this
.
initGeo
(
data
);
this
.
initGeo
(
data
);
this
.
initApprovals
(
data
);
this
.
initApprovals
(
data
);
super
.
setData
(
data
);
super
.
setData
(
data
,
isRebased
);
}
}
initGeo
(
data
)
{
initGeo
(
data
)
{
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_rebase_spec.js
View file @
a443acbc
...
@@ -114,7 +114,7 @@ describe('Merge request widget rebase component', () => {
...
@@ -114,7 +114,7 @@ describe('Merge request widget rebase component', () => {
// Wait for the eventHub to be called
// Wait for the eventHub to be called
.
then
(
vm
.
$nextTick
())
.
then
(
vm
.
$nextTick
())
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
MRWidget
UpdateRequested
'
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
MRWidget
RebaseSuccess
'
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js
View file @
a443acbc
...
@@ -35,7 +35,7 @@ describe('getStateKey', () => {
...
@@ -35,7 +35,7 @@ describe('getStateKey', () => {
expect
(
bound
()).
toEqual
(
'
mergeWhenPipelineSucceeds
'
);
expect
(
bound
()).
toEqual
(
'
mergeWhenPipelineSucceeds
'
);
context
.
hasSHAChanged
=
true
;
context
.
isSHAMismatch
=
true
;
expect
(
bound
()).
toEqual
(
'
shaMismatch
'
);
expect
(
bound
()).
toEqual
(
'
shaMismatch
'
);
...
...
spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
View file @
a443acbc
...
@@ -10,16 +10,23 @@ describe('MergeRequestStore', () => {
...
@@ -10,16 +10,23 @@ describe('MergeRequestStore', () => {
});
});
describe
(
'
setData
'
,
()
=>
{
describe
(
'
setData
'
,
()
=>
{
it
(
'
should set
hasSHAChanged
when the diff SHA changes
'
,
()
=>
{
it
(
'
should set
isSHAMismatch
when the diff SHA changes
'
,
()
=>
{
store
.
setData
({
...
mockData
,
diff_head_sha
:
'
a-different-string
'
});
store
.
setData
({
...
mockData
,
diff_head_sha
:
'
a-different-string
'
});
expect
(
store
.
hasSHAChanged
).
toBe
(
true
);
expect
(
store
.
isSHAMismatch
).
toBe
(
true
);
});
});
it
(
'
should not set
hasSHAChanged
when other data changes
'
,
()
=>
{
it
(
'
should not set
isSHAMismatch
when other data changes
'
,
()
=>
{
store
.
setData
({
...
mockData
,
work_in_progress
:
!
mockData
.
work_in_progress
});
store
.
setData
({
...
mockData
,
work_in_progress
:
!
mockData
.
work_in_progress
});
expect
(
store
.
hasSHAChanged
).
toBe
(
false
);
expect
(
store
.
isSHAMismatch
).
toBe
(
false
);
});
it
(
'
should update cached sha after rebasing
'
,
()
=>
{
store
.
setData
({
...
mockData
,
diff_head_sha
:
'
abc123
'
},
true
);
expect
(
store
.
isSHAMismatch
).
toBe
(
false
);
expect
(
store
.
sha
).
toBe
(
'
abc123
'
);
});
});
describe
(
'
isPipelinePassing
'
,
()
=>
{
describe
(
'
isPipelinePassing
'
,
()
=>
{
...
...
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