clean pleroma account's fields url, fix #200

This commit is contained in:
Nicolas Constant 2020-02-24 20:42:18 -05:00
parent 6a2ec8bd23
commit 5731962603
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 13 additions and 1 deletions

View File

@ -157,7 +157,7 @@ export class UserProfileComponent implements OnInit {
this.isLoading = false;
this.statusLoading = true;
this.displayedAccount = account;
this.displayedAccount = this.fixPleromaFieldsUrl(account);
this.hasNote = account && account.note && account.note !== '<p></p>';
if (this.hasNote) {
this.note = this.emojiConverter.applyEmojis(account.emojis, account.note, EmojiTypeEnum.medium);
@ -178,6 +178,18 @@ export class UserProfileComponent implements OnInit {
});
}
private fixPleromaFieldsUrl(acc: Account): Account {
if(acc.fields){
acc.fields.forEach(f => {
if(f.value.includes('<a href="') && !f.value.includes('target="_blank"')){
f.value = f.value.replace('<a href="', '<a target="_blank" href="');
}
});
}
return acc;
}
private getPinnedStatuses(userAccount: AccountInfo, account: Account): Promise<void> {
return this.mastodonService.getAccountStatuses(userAccount, account.id, false, true, false, null, null, 20)
.then((statuses: Status[]) => {