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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c17b7afa
Commit
c17b7afa
authored
Apr 03, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove reply_to_individual_notes feature flag
Also removes specs related to the flag
parent
645303c7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
146 deletions
+36
-146
app/assets/javascripts/notes/components/note_actions.vue
app/assets/javascripts/notes/components/note_actions.vue
+1
-4
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+0
-3
app/models/individual_note_discussion.rb
app/models/individual_note_discussion.rb
+1
-1
spec/features/merge_request/user_posts_notes_spec.rb
spec/features/merge_request/user_posts_notes_spec.rb
+1
-12
spec/javascripts/notes/components/note_actions_spec.js
spec/javascripts/notes/components/note_actions_spec.js
+14
-68
spec/services/notes/build_service_spec.rb
spec/services/notes/build_service_spec.rb
+9
-27
spec/services/notes/create_service_spec.rb
spec/services/notes/create_service_spec.rb
+10
-31
No files found.
app/assets/javascripts/notes/components/note_actions.vue
View file @
c17b7afa
...
@@ -86,9 +86,6 @@ export default {
...
@@ -86,9 +86,6 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapGetters
([
'
getUserDataByProp
'
]),
...
mapGetters
([
'
getUserDataByProp
'
]),
showReplyButton
()
{
return
gon
.
features
&&
gon
.
features
.
replyToIndividualNotes
&&
this
.
showReply
;
},
shouldShowActionsDropdown
()
{
shouldShowActionsDropdown
()
{
return
this
.
currentUserId
&&
(
this
.
canEdit
||
this
.
canReportAsAbuse
);
return
this
.
currentUserId
&&
(
this
.
canEdit
||
this
.
canReportAsAbuse
);
},
},
...
@@ -167,7 +164,7 @@ export default {
...
@@ -167,7 +164,7 @@ export default {
</a>
</a>
</div>
</div>
<reply-button
<reply-button
v-if=
"showReply
Button
"
v-if=
"showReply"
ref=
"replyButton"
ref=
"replyButton"
class=
"js-reply-button"
class=
"js-reply-button"
@
startReplying=
"$emit('startReplying')"
@
startReplying=
"$emit('startReplying')"
...
...
app/controllers/concerns/issuable_actions.rb
View file @
c17b7afa
...
@@ -7,9 +7,6 @@ module IssuableActions
...
@@ -7,9 +7,6 @@ module IssuableActions
included
do
included
do
before_action
:authorize_destroy_issuable!
,
only: :destroy
before_action
:authorize_destroy_issuable!
,
only: :destroy
before_action
:authorize_admin_issuable!
,
only: :bulk_update
before_action
:authorize_admin_issuable!
,
only: :bulk_update
before_action
only: :show
do
push_frontend_feature_flag
(
:reply_to_individual_notes
,
default_enabled:
true
)
end
end
end
def
permitted_keys
def
permitted_keys
...
...
app/models/individual_note_discussion.rb
View file @
c17b7afa
...
@@ -14,7 +14,7 @@ class IndividualNoteDiscussion < Discussion
...
@@ -14,7 +14,7 @@ class IndividualNoteDiscussion < Discussion
end
end
def
can_convert_to_discussion?
def
can_convert_to_discussion?
noteable
.
supports_replying_to_individual_notes?
&&
Feature
.
enabled?
(
:reply_to_individual_notes
,
default_enabled:
true
)
noteable
.
supports_replying_to_individual_notes?
end
end
def
convert_to_discussion!
(
save:
false
)
def
convert_to_discussion!
(
save:
false
)
...
...
spec/features/merge_request/user_posts_notes_spec.rb
View file @
c17b7afa
...
@@ -67,18 +67,7 @@ describe 'Merge request > User posts notes', :js do
...
@@ -67,18 +67,7 @@ describe 'Merge request > User posts notes', :js do
end
end
end
end
describe
'when reply_to_individual_notes feature flag is disabled'
do
describe
'reply button'
do
before
do
stub_feature_flags
(
reply_to_individual_notes:
false
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not show a reply button'
do
expect
(
page
).
to
have_no_selector
(
'.js-reply-button'
)
end
end
describe
'when reply_to_individual_notes feature flag is not set'
do
before
do
before
do
visit
project_merge_request_path
(
project
,
merge_request
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
end
...
...
spec/javascripts/notes/components/note_actions_spec.js
View file @
c17b7afa
...
@@ -128,87 +128,33 @@ describe('noteActions', () => {
...
@@ -128,87 +128,33 @@ describe('noteActions', () => {
});
});
});
});
describe
(
'
with feature flag replyToIndividualNotes enabled
'
,
()
=>
{
describe
(
'
for showReply = true
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
gon
.
features
=
{
wrapper
=
shallowMountNoteActions
({
replyToIndividualNotes
:
true
,
...
props
,
};
showReply
:
true
,
});
afterEach
(()
=>
{
gon
.
features
=
{};
});
describe
(
'
for showReply = true
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
shallowMountNoteActions
({
...
props
,
showReply
:
true
,
});
});
it
(
'
shows a reply button
'
,
()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
expect
(
replyButton
.
exists
()).
toBe
(
true
);
});
});
});
});
describe
(
'
for showReply = false
'
,
()
=>
{
it
(
'
shows a reply button
'
,
()
=>
{
beforeEach
(()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
wrapper
=
shallowMountNoteActions
({
...
props
,
showReply
:
false
,
});
});
it
(
'
does not show a reply button
'
,
()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
expect
(
replyButton
.
exists
()).
toBe
(
false
);
expect
(
replyButton
.
exists
()).
toBe
(
true
);
});
});
});
});
});
describe
(
'
with feature flag replyToIndividualNotes disabled
'
,
()
=>
{
describe
(
'
for showReply = false
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
gon
.
features
=
{
wrapper
=
shallowMountNoteActions
({
replyToIndividualNotes
:
false
,
...
props
,
};
showReply
:
false
,
});
afterEach
(()
=>
{
gon
.
features
=
{};
});
describe
(
'
for showReply = true
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
shallowMountNoteActions
({
...
props
,
showReply
:
true
,
});
});
it
(
'
does not show a reply button
'
,
()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
expect
(
replyButton
.
exists
()).
toBe
(
false
);
});
});
});
});
describe
(
'
for showReply = false
'
,
()
=>
{
it
(
'
does not show a reply button
'
,
()
=>
{
beforeEach
(()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
wrapper
=
shallowMountNoteActions
({
...
props
,
showReply
:
false
,
});
});
it
(
'
does not show a reply button
'
,
()
=>
{
const
replyButton
=
wrapper
.
find
({
ref
:
'
replyButton
'
});
expect
(
replyButton
.
exists
()).
toBe
(
false
);
expect
(
replyButton
.
exists
()).
toBe
(
false
);
});
});
});
});
});
});
});
spec/services/notes/build_service_spec.rb
View file @
c17b7afa
...
@@ -128,37 +128,19 @@ describe Notes::BuildService do
...
@@ -128,37 +128,19 @@ describe Notes::BuildService do
subject
{
described_class
.
new
(
project
,
author
,
note:
'Test'
,
in_reply_to_discussion_id:
note
.
discussion_id
).
execute
}
subject
{
described_class
.
new
(
project
,
author
,
note:
'Test'
,
in_reply_to_discussion_id:
note
.
discussion_id
).
execute
}
shared_examples
'an individual note reply'
do
it
'sets the note up to be in reply to that note'
do
it
'builds another individual note'
do
expect
(
subject
).
to
be_valid
expect
(
subject
).
to
be_valid
expect
(
subject
).
to
be_a
(
DiscussionNote
)
expect
(
subject
).
to
be_a
(
Note
)
expect
(
subject
.
discussion_id
).
to
eq
(
note
.
discussion_id
)
expect
(
subject
.
discussion_id
).
not_to
eq
(
note
.
discussion_id
)
end
end
end
context
'when reply_to_individual_notes is disabled'
do
context
'when noteable does not support replies'
do
before
do
let
(
:note
)
{
create
(
:note_on_commit
)
}
stub_feature_flags
(
reply_to_individual_notes:
false
)
end
it_behaves_like
'an individual note reply'
end
context
'when reply_to_individual_notes is enabled'
do
it
'builds another individual note'
do
before
do
stub_feature_flags
(
reply_to_individual_notes:
true
)
end
it
'sets the note up to be in reply to that note'
do
expect
(
subject
).
to
be_valid
expect
(
subject
).
to
be_valid
expect
(
subject
).
to
be_a
(
DiscussionNote
)
expect
(
subject
).
to
be_a
(
Note
)
expect
(
subject
.
discussion_id
).
to
eq
(
note
.
discussion_id
)
expect
(
subject
.
discussion_id
).
not_to
eq
(
note
.
discussion_id
)
end
context
'when noteable does not support replies'
do
let
(
:note
)
{
create
(
:note_on_commit
)
}
it_behaves_like
'an individual note reply'
end
end
end
end
end
end
...
...
spec/services/notes/create_service_spec.rb
View file @
c17b7afa
...
@@ -298,41 +298,20 @@ describe Notes::CreateService do
...
@@ -298,41 +298,20 @@ describe Notes::CreateService do
subject
{
described_class
.
new
(
project
,
user
,
reply_opts
).
execute
}
subject
{
described_class
.
new
(
project
,
user
,
reply_opts
).
execute
}
context
'when reply_to_individual_notes is disabled'
do
it
'creates a DiscussionNote in reply to existing note'
do
before
do
expect
(
subject
).
to
be_a
(
DiscussionNote
)
stub_feature_flags
(
reply_to_individual_notes:
false
)
expect
(
subject
.
discussion_id
).
to
eq
(
existing_note
.
discussion_id
)
end
it
'creates an individual note'
do
expect
(
subject
.
type
).
to
eq
(
nil
)
expect
(
subject
.
discussion_id
).
not_to
eq
(
existing_note
.
discussion_id
)
end
it
'does not convert existing note'
do
expect
{
subject
}.
not_to
change
{
existing_note
.
reload
.
type
}
end
end
end
context
'when reply_to_individual_notes is enabled'
do
it
'converts existing note to DiscussionNote'
do
before
do
expect
do
stub_feature_flags
(
reply_to_individual_notes:
true
)
existing_note
end
it
'creates a DiscussionNote in reply to existing note'
do
expect
(
subject
).
to
be_a
(
DiscussionNote
)
expect
(
subject
.
discussion_id
).
to
eq
(
existing_note
.
discussion_id
)
end
it
'converts existing note to DiscussionNote'
do
expect
do
existing_note
Timecop
.
freeze
(
Time
.
now
+
1
.
minute
)
{
subject
}
Timecop
.
freeze
(
Time
.
now
+
1
.
minute
)
{
subject
}
existing_note
.
reload
existing_note
.
reload
end
.
to
change
{
existing_note
.
type
}.
from
(
nil
).
to
(
'DiscussionNote'
)
end
.
to
change
{
existing_note
.
type
}.
from
(
nil
).
to
(
'DiscussionNote'
)
.
and
change
{
existing_note
.
updated_at
}
.
and
change
{
existing_note
.
updated_at
}
end
end
end
end
end
end
end
...
...
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