Refactor statusToTextMentions, fixes #80

merge-requests/12/head
Alex Gleason 2020-05-17 17:22:32 -05:00
rodzic b78e923f83
commit ed61603b10
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 8 dodań i 7 usunięć

Wyświetl plik

@ -79,14 +79,15 @@ const initialPoll = ImmutableMap({
}); });
function statusToTextMentions(state, status) { function statusToTextMentions(state, status) {
let set = ImmutableOrderedSet([]); const me = state.getIn(['accounts', state.get('me'), 'acct']);
const me = state.get('me'); const author = state.getIn(['accounts', status.get('account'), 'acct']);
const mentions = status.get('mentions', []).map(m => m.get('acct'));
if (status.getIn(['account', 'id']) !== me) { return ImmutableOrderedSet([author])
set = set.add(`@${status.getIn(['account', 'acct'])} `); .concat(mentions)
} .delete(me)
.map(m => `@${m} `)
return set.union(status.get('mentions').filterNot(mention => mention.get('id') === me).map(mention => `@${mention.get('acct')} `)).join(''); .join('');
}; };
function clearAll(state) { function clearAll(state) {