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
7277e2c6
Commit
7277e2c6
authored
Aug 07, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
8a7babac
e3c74e52
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
78 additions
and
13 deletions
+78
-13
app/assets/javascripts/jobs/components/empty_state.vue
app/assets/javascripts/jobs/components/empty_state.vue
+1
-1
app/assets/javascripts/notes/components/discussion_filter.vue
...assets/javascripts/notes/components/discussion_filter.vue
+7
-3
app/assets/javascripts/notes/services/notes_service.js
app/assets/javascripts/notes/services/notes_service.js
+5
-2
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+4
-4
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+2
-1
changelogs/unreleased/61445-prevent-persisting-auto-switch-discussion-filter.yml
...1445-prevent-persisting-auto-switch-discussion-filter.yml
+6
-0
changelogs/unreleased/65705-two-buttons.yml
changelogs/unreleased/65705-two-buttons.yml
+5
-0
spec/features/user_opens_link_to_comment_spec.rb
spec/features/user_opens_link_to_comment_spec.rb
+5
-0
spec/javascripts/jobs/components/empty_state_spec.js
spec/javascripts/jobs/components/empty_state_spec.js
+7
-1
spec/javascripts/notes/stores/actions_spec.js
spec/javascripts/notes/stores/actions_spec.js
+27
-0
spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb
...ples/controllers/issuable_notes_filter_shared_examples.rb
+9
-1
No files found.
app/assets/javascripts/jobs/components/empty_state.vue
View file @
7277e2c6
...
...
@@ -81,7 +81,7 @@ export default {
:variables-settings-url=
"variablesSettingsUrl"
/>
<div
class=
"text-content"
>
<div
v-if=
"action"
class=
"text-center"
>
<div
v-if=
"action
&& !shouldRenderManualVariables
"
class=
"text-center"
>
<gl-link
:href=
"action.path"
:data-method=
"action.method"
...
...
app/assets/javascripts/notes/components/discussion_filter.vue
View file @
7277e2c6
...
...
@@ -61,7 +61,7 @@ export default {
},
methods
:
{
...
mapActions
([
'
filterDiscussion
'
,
'
setCommentsDisabled
'
,
'
setTargetNoteHash
'
]),
selectFilter
(
value
)
{
selectFilter
(
value
,
persistFilter
=
true
)
{
const
filter
=
parseInt
(
value
,
10
);
// close dropdown
...
...
@@ -69,7 +69,11 @@ export default {
if
(
filter
===
this
.
currentValue
)
return
;
this
.
currentValue
=
filter
;
this
.
filterDiscussion
({
path
:
this
.
getNotesDataByProp
(
'
discussionsPath
'
),
filter
});
this
.
filterDiscussion
({
path
:
this
.
getNotesDataByProp
(
'
discussionsPath
'
),
filter
,
persistFilter
,
});
this
.
toggleCommentsForm
();
},
toggleDropdown
()
{
...
...
@@ -85,7 +89,7 @@ export default {
const
hash
=
getLocationHash
();
if
(
/^note_/
.
test
(
hash
)
&&
this
.
currentValue
!==
DISCUSSION_FILTERS_DEFAULT_VALUE
)
{
this
.
selectFilter
(
this
.
defaultValue
);
this
.
selectFilter
(
this
.
defaultValue
,
false
);
this
.
toggleDropdown
();
// close dropdown
this
.
setTargetNoteHash
(
hash
);
}
...
...
app/assets/javascripts/notes/services/notes_service.js
View file @
7277e2c6
...
...
@@ -5,8 +5,11 @@ import * as constants from '../constants';
Vue
.
use
(
VueResource
);
export
default
{
fetchDiscussions
(
endpoint
,
filter
)
{
const
config
=
filter
!==
undefined
?
{
params
:
{
notes_filter
:
filter
}
}
:
null
;
fetchDiscussions
(
endpoint
,
filter
,
persistFilter
=
true
)
{
const
config
=
filter
!==
undefined
?
{
params
:
{
notes_filter
:
filter
,
persist_filter
:
persistFilter
}
}
:
null
;
return
Vue
.
http
.
get
(
endpoint
,
config
);
},
replyToDiscussion
(
endpoint
,
data
)
{
...
...
app/assets/javascripts/notes/stores/actions.js
View file @
7277e2c6
...
...
@@ -46,9 +46,9 @@ export const setNotesFetchedState = ({ commit }, state) =>
export
const
toggleDiscussion
=
({
commit
},
data
)
=>
commit
(
types
.
TOGGLE_DISCUSSION
,
data
);
export
const
fetchDiscussions
=
({
commit
,
dispatch
},
{
path
,
filter
})
=>
export
const
fetchDiscussions
=
({
commit
,
dispatch
},
{
path
,
filter
,
persistFilter
})
=>
service
.
fetchDiscussions
(
path
,
filter
)
.
fetchDiscussions
(
path
,
filter
,
persistFilter
)
.
then
(
res
=>
res
.
json
())
.
then
(
discussions
=>
{
commit
(
types
.
SET_INITIAL_DISCUSSIONS
,
discussions
);
...
...
@@ -411,9 +411,9 @@ export const setLoadingState = ({ commit }, data) => {
commit
(
types
.
SET_NOTES_LOADING_STATE
,
data
);
};
export
const
filterDiscussion
=
({
dispatch
},
{
path
,
filter
})
=>
{
export
const
filterDiscussion
=
({
dispatch
},
{
path
,
filter
,
persistFilter
})
=>
{
dispatch
(
'
setLoadingState
'
,
true
);
dispatch
(
'
fetchDiscussions
'
,
{
path
,
filter
})
dispatch
(
'
fetchDiscussions
'
,
{
path
,
filter
,
persistFilter
})
.
then
(()
=>
{
dispatch
(
'
setLoadingState
'
,
false
);
dispatch
(
'
setNotesFetchedState
'
,
true
);
...
...
app/controllers/concerns/issuable_actions.rb
View file @
7277e2c6
...
...
@@ -127,7 +127,8 @@ module IssuableActions
# GitLab Geo does not expect database UPDATE or INSERT statements to happen
# on GET requests.
# This is just a fail-safe in case notes_filter is sent via GET request in GitLab Geo.
if
Gitlab
::
Database
.
read_only?
# In some cases, we also force the filter to not be persisted with the `persist_filter` param
if
Gitlab
::
Database
.
read_only?
||
params
[
:persist_filter
]
==
'false'
notes_filter_param
||
current_user
&
.
notes_filter_for
(
issuable
)
else
notes_filter
=
current_user
&
.
set_notes_filter
(
notes_filter_param
,
issuable
)
||
notes_filter_param
...
...
changelogs/unreleased/61445-prevent-persisting-auto-switch-discussion-filter.yml
0 → 100644
View file @
7277e2c6
---
title
:
Prevent discussion filter from persisting to `Show all activity` when opening
links to notes
merge_request
:
31229
author
:
type
:
fixed
changelogs/unreleased/65705-two-buttons.yml
0 → 100644
View file @
7277e2c6
---
title
:
Prevent duplicated trigger action button
merge_request
:
author
:
type
:
fixed
spec/features/user_opens_link_to_comment_spec.rb
View file @
7277e2c6
...
...
@@ -18,8 +18,13 @@ describe 'User opens link to comment', :js do
visit
Gitlab
::
UrlBuilder
.
build
(
note
)
wait_for_requests
expect
(
page
.
find
(
'#discussion-filter-dropdown'
)).
to
have_content
(
'Show all activity'
)
expect
(
page
).
not_to
have_content
(
'Something went wrong while fetching comments'
)
# Auto-switching to show all notes shouldn't be persisted
expect
(
user
.
reload
.
notes_filter_for
(
note
.
noteable
)).
to
eq
(
UserPreference
::
NOTES_FILTERS
[
:only_activity
])
end
end
...
...
spec/
frontend
/jobs/components/empty_state_spec.js
→
spec/
javascripts
/jobs/components/empty_state_spec.js
View file @
7277e2c6
...
...
@@ -105,7 +105,7 @@ describe('Empty State', () => {
});
describe
(
'
with playbale action and not scheduled job
'
,
()
=>
{
it
(
'
renders manual variables form
'
,
()
=>
{
beforeEach
(
()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
content
,
...
...
@@ -117,9 +117,15 @@ describe('Empty State', () => {
method
:
'
post
'
,
},
});
});
it
(
'
renders manual variables form
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-manual-vars-form
'
)).
not
.
toBeNull
();
});
it
(
'
does not render the empty state action
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-action
'
)).
toBeNull
();
});
});
describe
(
'
with playbale action and scheduled job
'
,
()
=>
{
...
...
spec/javascripts/notes/stores/actions_spec.js
View file @
7277e2c6
...
...
@@ -892,4 +892,31 @@ describe('Actions Notes Store', () => {
});
});
});
describe
(
'
filterDiscussion
'
,
()
=>
{
const
path
=
'
some-discussion-path
'
;
const
filter
=
0
;
beforeEach
(()
=>
{
dispatch
.
and
.
returnValue
(
new
Promise
(()
=>
{}));
});
it
(
'
fetches discussions with filter and persistFilter false
'
,
()
=>
{
actions
.
filterDiscussion
({
dispatch
},
{
path
,
filter
,
persistFilter
:
false
});
expect
(
dispatch
.
calls
.
allArgs
()).
toEqual
([
[
'
setLoadingState
'
,
true
],
[
'
fetchDiscussions
'
,
{
path
,
filter
,
persistFilter
:
false
}],
]);
});
it
(
'
fetches discussions with filter and persistFilter true
'
,
()
=>
{
actions
.
filterDiscussion
({
dispatch
},
{
path
,
filter
,
persistFilter
:
true
});
expect
(
dispatch
.
calls
.
allArgs
()).
toEqual
([
[
'
setLoadingState
'
,
true
],
[
'
fetchDiscussions
'
,
{
path
,
filter
,
persistFilter
:
true
}],
]);
});
});
});
spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb
View file @
7277e2c6
...
...
@@ -41,7 +41,15 @@ shared_examples 'issuable notes filter' do
get
:discussions
,
params:
params
.
merge
(
notes_filter:
notes_filter
)
expect
(
user
.
reload
.
notes_filter_for
(
issuable
)).
to
eq
(
0
)
expect
(
user
.
reload
.
notes_filter_for
(
issuable
)).
to
eq
(
UserPreference
::
NOTES_FILTERS
[
:all_notes
])
end
it
'does not set notes filter when persist_filter param is false'
do
notes_filter
=
UserPreference
::
NOTES_FILTERS
[
:only_comments
]
get
:discussions
,
params:
params
.
merge
(
notes_filter:
notes_filter
,
persist_filter:
false
)
expect
(
user
.
reload
.
notes_filter_for
(
issuable
)).
to
eq
(
UserPreference
::
NOTES_FILTERS
[
:all_notes
])
end
it
'returns only user comments'
do
...
...
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