kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Refactor statusToTextMentions, fixes #80
rodzic
b78e923f83
commit
ed61603b10
|
@ -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) {
|
||||||
|
|
Ładowanie…
Reference in New Issue