mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
![Thibaut Girka](/assets/img/avatar_default.png)
Port 4c03e05a4e
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`.
32 lines
980 B
JavaScript
32 lines
980 B
JavaScript
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);
|