[Glitch] Fix searching for additional hashtags in hashtag column

Port 5305dada6c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Claire 2021-11-26 22:11:09 +01:00
parent 9565dc366d
commit b22b76a571
1 changed files with 10 additions and 9 deletions

View File

@ -11,21 +11,22 @@ const mapStateToProps = (state, { columnId }) => {
return {}; return {};
} }
return { settings: columns.get(index).get('params') }; return {
settings: columns.get(index).get('params'),
onLoad (value) {
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` };
});
});
},
};
}; };
const mapDispatchToProps = (dispatch, { columnId }) => ({ const mapDispatchToProps = (dispatch, { columnId }) => ({
onChange (key, value) { onChange (key, value) {
dispatch(changeColumnParams(columnId, key, value)); dispatch(changeColumnParams(columnId, key, value));
}, },
onLoad (value) {
return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` };
});
});
},
}); });
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings); export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);