From 4be73132982fec0a38420811ae28a4ffd2ea09c7 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 18 Dec 2018 17:56:08 +0100 Subject: [Glitch] Allow joining several hashtags in a single column Port 4c03e05a4e1a237f8a414a0861c03abe3269dbc8 to glitch-soc This introduces new requirements in the API: `/api/v1/timelines/tag/:tag` now accepts new params: `any`, `all` and `none` It now returns status matching tag :tag or any of the :any, provided that they also include all tags in `all` and none of `none`. --- .../containers/column_settings_container.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js (limited to 'app/javascript/flavours/glitch/features/hashtag_timeline/containers') diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js new file mode 100644 index 000000000..757cd48fb --- /dev/null +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js @@ -0,0 +1,31 @@ +import { connect } from 'react-redux'; +import ColumnSettings from '../components/column_settings'; +import { changeColumnParams } from 'flavours/glitch/actions/columns'; +import api from 'flavours/glitch/util/api'; + +const mapStateToProps = (state, { columnId }) => { + const columns = state.getIn(['settings', 'columns']); + const index = columns.findIndex(c => c.get('uuid') === columnId); + + if (!(columnId && index >= 0)) { + return {}; + } + + return { settings: columns.get(index).get('params') }; +}; + +const mapDispatchToProps = (dispatch, { columnId }) => ({ + onChange (key, value) { + dispatch(changeColumnParams(columnId, key, value)); + }, + + onLoad (value) { + return api().get('/api/v2/search', { params: { q: value } }).then(response => { + return (response.data.hashtags || []).map((tag) => { + return { value: tag.name, label: `#${tag.name}` }; + }); + }); + }, +}); + +export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings); -- cgit