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
d72d6cb3
Commit
d72d6cb3
authored
Jun 17, 2020
by
André Luís
Committed by
Paul Slaughter
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put Batched Suggestions behind a Feature Flag default to false
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34782
parent
ce62970d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
9 deletions
+43
-9
app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue
...vue_shared/components/markdown/suggestion_diff_header.vue
+20
-8
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js
...shared/components/markdown/suggestion_diff_header_spec.js
+19
-1
No files found.
app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue
View file @
d72d6cb3
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
import
{
GlDeprecatedButton
,
GlLoadingIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlDeprecatedButton
,
GlLoadingIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
export
default
{
export
default
{
components
:
{
Icon
,
GlDeprecatedButton
,
GlLoadingIcon
},
components
:
{
Icon
,
GlDeprecatedButton
,
GlLoadingIcon
},
directives
:
{
'
gl-tooltip
'
:
GlTooltipDirective
},
directives
:
{
'
gl-tooltip
'
:
GlTooltipDirective
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
props
:
{
batchSuggestionsCount
:
{
batchSuggestionsCount
:
{
type
:
Number
,
type
:
Number
,
...
@@ -43,6 +45,9 @@ export default {
...
@@ -43,6 +45,9 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
canBeBatched
()
{
return
Boolean
(
this
.
glFeatures
.
batchSuggestions
);
},
isApplying
()
{
isApplying
()
{
return
this
.
isApplyingSingle
||
this
.
isApplyingBatch
;
return
this
.
isApplyingSingle
||
this
.
isApplyingBatch
;
},
},
...
@@ -51,6 +56,11 @@ export default {
...
@@ -51,6 +56,11 @@ export default {
?
__
(
'
This also resolves the discussion
'
)
?
__
(
'
This also resolves the discussion
'
)
:
__
(
"
Can't apply as this line has changed or the suggestion already matches its content.
"
);
:
__
(
"
Can't apply as this line has changed or the suggestion already matches its content.
"
);
},
},
tooltipMessageBatch
()
{
return
!
this
.
canBeBatched
?
__
(
"
Suggestions that change line count can't be added to batches, yet.
"
)
:
this
.
tooltipMessage
;
},
isDisableButton
()
{
isDisableButton
()
{
return
this
.
isApplying
||
!
this
.
canApply
;
return
this
.
isApplying
||
!
this
.
canApply
;
},
},
...
@@ -97,7 +107,7 @@ export default {
...
@@ -97,7 +107,7 @@ export default {
<gl-loading-icon
class=
"d-flex-center mr-2"
/>
<gl-loading-icon
class=
"d-flex-center mr-2"
/>
<span>
{{
applyingSuggestionsMessage
}}
</span>
<span>
{{
applyingSuggestionsMessage
}}
</span>
</div>
</div>
<div
v-else-if=
"canApply && isBatched"
class=
"d-flex align-items-center"
>
<div
v-else-if=
"canApply &&
canBeBatched &&
isBatched"
class=
"d-flex align-items-center"
>
<gl-deprecated-button
<gl-deprecated-button
class=
"btn-inverted js-remove-from-batch-btn btn-grouped"
class=
"btn-inverted js-remove-from-batch-btn btn-grouped"
:disabled=
"isApplying"
:disabled=
"isApplying"
...
@@ -119,13 +129,15 @@ export default {
...
@@ -119,13 +129,15 @@ export default {
</gl-deprecated-button>
</gl-deprecated-button>
</div>
</div>
<div
v-else
class=
"d-flex align-items-center"
>
<div
v-else
class=
"d-flex align-items-center"
>
<gl-deprecated-button
<span
v-if=
"canBeBatched"
v-gl-tooltip.viewport=
"tooltipMessageBatch"
tabindex=
"0"
>
class=
"btn-inverted js-add-to-batch-btn btn-grouped"
<gl-deprecated-button
:disabled=
"isDisableButton"
class=
"btn-inverted js-add-to-batch-btn btn-grouped"
@
click=
"addSuggestionToBatch"
:disabled=
"isDisableButton"
>
@
click=
"addSuggestionToBatch"
{{
__
(
'
Add suggestion to batch
'
)
}}
>
</gl-deprecated-button>
{{
__
(
'
Add suggestion to batch
'
)
}}
</gl-deprecated-button>
</span>
<span
v-gl-tooltip.viewport=
"tooltipMessage"
tabindex=
"0"
>
<span
v-gl-tooltip.viewport=
"tooltipMessage"
tabindex=
"0"
>
<gl-deprecated-button
<gl-deprecated-button
class=
"btn-inverted js-apply-btn btn-grouped"
class=
"btn-inverted js-apply-btn btn-grouped"
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
d72d6cb3
...
@@ -35,6 +35,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
...
@@ -35,6 +35,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag
(
:mr_commit_neighbor_nav
,
@project
,
default_enabled:
true
)
push_frontend_feature_flag
(
:mr_commit_neighbor_nav
,
@project
,
default_enabled:
true
)
push_frontend_feature_flag
(
:multiline_comments
,
@project
)
push_frontend_feature_flag
(
:multiline_comments
,
@project
)
push_frontend_feature_flag
(
:file_identifier_hash
)
push_frontend_feature_flag
(
:file_identifier_hash
)
push_frontend_feature_flag
(
:batch_suggestions
,
@project
)
end
end
before_action
do
before_action
do
...
...
locale/gitlab.pot
View file @
d72d6cb3
...
@@ -21877,6 +21877,9 @@ msgstr ""
...
@@ -21877,6 +21877,9 @@ msgstr ""
msgid "Suggestions must all be on the same branch."
msgid "Suggestions must all be on the same branch."
msgstr ""
msgstr ""
msgid "Suggestions that change line count can't be added to batches, yet."
msgstr ""
msgid "Suggestions:"
msgid "Suggestions:"
msgstr ""
msgstr ""
...
...
spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js
View file @
d72d6cb3
...
@@ -14,12 +14,18 @@ const DEFAULT_PROPS = {
...
@@ -14,12 +14,18 @@ const DEFAULT_PROPS = {
describe
(
'
Suggestion Diff component
'
,
()
=>
{
describe
(
'
Suggestion Diff component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
,
glFeatures
=
{})
=>
{
wrapper
=
shallowMount
(
SuggestionDiffHeader
,
{
wrapper
=
shallowMount
(
SuggestionDiffHeader
,
{
propsData
:
{
propsData
:
{
...
DEFAULT_PROPS
,
...
DEFAULT_PROPS
,
...
props
,
...
props
,
},
},
provide
:
{
glFeatures
:
{
batchSuggestions
:
true
,
...
glFeatures
,
},
},
});
});
};
};
...
@@ -204,6 +210,18 @@ describe('Suggestion Diff component', () => {
...
@@ -204,6 +210,18 @@ describe('Suggestion Diff component', () => {
});
});
});
});
describe
(
'
batchSuggestions feature flag is set to false
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({},
{
batchSuggestions
:
false
});
});
it
(
'
disables add to batch buttons but keeps apply suggestion enabled
'
,
()
=>
{
expect
(
findApplyButton
().
exists
()).
toBe
(
true
);
expect
(
findAddToBatchButton
().
exists
()).
toBe
(
false
);
expect
(
findApplyButton
().
attributes
(
'
disabled
'
)).
not
.
toBe
(
'
true
'
);
});
});
describe
(
'
canApply is set to false
'
,
()
=>
{
describe
(
'
canApply is set to false
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
canApply
:
false
});
createComponent
({
canApply
:
false
});
...
...
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