Composer: Only process mentions if they exist, fixes #133

stable/1.0.x
Alex Gleason 2020-06-07 16:06:31 -05:00
rodzic 9871d0f37c
commit 374e985e37
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -191,7 +191,8 @@ const expandMentions = status => {
const fragment = domParser.parseFromString(status.get('content'), 'text/html').documentElement;
status.get('mentions').forEach(mention => {
fragment.querySelector(`a[href="${mention.get('url')}"]`).textContent = `@${mention.get('acct')}`;
const node = fragment.querySelector(`a[href="${mention.get('url')}"]`);
if (node) node.textContent = `@${mention.get('acct')}`;
});
return fragment.innerHTML;