diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-03-13 18:00:29 +0800 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-03-19 13:07:46 +0800 |
commit | c307bd473626250a5ac8caddce26c4c4b373b6c1 (patch) | |
tree | f99dcaf54ee020ffc8c993bbcaa970c1444c30c0 /app/assets/javascripts/notes/discussion_filters.js | |
parent | a3b3da72775fd37f7533ddd88fe47600079b4ed9 (diff) | |
download | gitlab-ce-c307bd473626250a5ac8caddce26c4c4b373b6c1.tar.gz |
Initialize discussion filter after notes app
Also sets default selectedValue for discussion filter when not logged in
Diffstat (limited to 'app/assets/javascripts/notes/discussion_filters.js')
-rw-r--r-- | app/assets/javascripts/notes/discussion_filters.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/assets/javascripts/notes/discussion_filters.js b/app/assets/javascripts/notes/discussion_filters.js index 5c5f38a3fb0..cdf9a46c5aa 100644 --- a/app/assets/javascripts/notes/discussion_filters.js +++ b/app/assets/javascripts/notes/discussion_filters.js @@ -6,12 +6,16 @@ export default store => { if (discussionFilterEl) { const { defaultFilter, notesFilters } = discussionFilterEl.dataset; - const selectedValue = defaultFilter ? parseInt(defaultFilter, 10) : null; const filterValues = notesFilters ? JSON.parse(notesFilters) : {}; const filters = Object.keys(filterValues).map(entry => ({ title: entry, value: filterValues[entry], })); + const props = { filters }; + + if (defaultFilter) { + props.selectedValue = parseInt(defaultFilter, 10); + } return new Vue({ el: discussionFilterEl, @@ -21,12 +25,7 @@ export default store => { }, store, render(createElement) { - return createElement('discussion-filter', { - props: { - filters, - selectedValue, - }, - }); + return createElement('discussion-filter', { props }); }, }); } |