|
|
@ -130,7 +130,7 @@ export function submitCompose() {
|
|
|
|
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
|
|
|
|
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).then(function (response) {
|
|
|
|
}).then(function (response) {
|
|
|
|
dispatch(insertIntoTagHistory(response.data.tags));
|
|
|
|
dispatch(insertIntoTagHistory(response.data.tags, status));
|
|
|
|
dispatch(submitComposeSuccess({ ...response.data }));
|
|
|
|
dispatch(submitComposeSuccess({ ...response.data }));
|
|
|
|
|
|
|
|
|
|
|
|
// To make the app more responsive, immediately get the status into the columns
|
|
|
|
// To make the app more responsive, immediately get the status into the columns
|
|
|
@ -390,13 +390,13 @@ export function hydrateCompose() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function insertIntoTagHistory(tags) {
|
|
|
|
function insertIntoTagHistory(recognizedTags, text) {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
const state = getState();
|
|
|
|
const state = getState();
|
|
|
|
const oldHistory = state.getIn(['compose', 'tagHistory']);
|
|
|
|
const oldHistory = state.getIn(['compose', 'tagHistory']);
|
|
|
|
const me = state.getIn(['meta', 'me']);
|
|
|
|
const me = state.getIn(['meta', 'me']);
|
|
|
|
const names = tags.map(({ name }) => name);
|
|
|
|
const names = recognizedTags.map(tag => text.match(new RegExp(`#${tag.name}`, 'i'))[0].slice(1));
|
|
|
|
const intersectedOldHistory = oldHistory.filter(name => !names.includes(name));
|
|
|
|
const intersectedOldHistory = oldHistory.filter(name => names.findIndex(newName => newName.toLowerCase() === name.toLowerCase()) === -1);
|
|
|
|
|
|
|
|
|
|
|
|
names.push(...intersectedOldHistory.toJS());
|
|
|
|
names.push(...intersectedOldHistory.toJS());
|
|
|
|
|
|
|
|
|
|
|
|