fix emoji pipeline
This commit is contained in:
parent
560147743d
commit
6f96de22ce
|
@ -4,19 +4,22 @@ import { EmojiConverter, EmojiTypeEnum } from '../tools/emoji.tools';
|
||||||
import { Account } from '../services/models/mastodon.interfaces';
|
import { Account } from '../services/models/mastodon.interfaces';
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: "accountEmoji"
|
name: "accountEmoji"
|
||||||
})
|
})
|
||||||
export class AccountEmojiPipe implements PipeTransform {
|
export class AccountEmojiPipe implements PipeTransform {
|
||||||
private emojiConverter = new EmojiConverter();
|
private emojiConverter = new EmojiConverter();
|
||||||
|
|
||||||
transform(value: Account, text?: string): any {
|
transform(value: Account, text?: string): any {
|
||||||
|
try {
|
||||||
|
let textToTransform = text;
|
||||||
|
if (!text) {
|
||||||
|
if (value.display_name) textToTransform = value.display_name;
|
||||||
|
else textToTransform = value.acct.split('@')[0];
|
||||||
|
}
|
||||||
|
|
||||||
let textToTransform = text;
|
return this.emojiConverter.applyEmojis(value.emojis, textToTransform, EmojiTypeEnum.small);
|
||||||
if(!text){
|
} catch (err){
|
||||||
if(value.display_name) textToTransform = value.display_name;
|
return '';
|
||||||
else textToTransform = value.acct.split('@')[0];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.emojiConverter.applyEmojis(value.emojis, textToTransform, EmojiTypeEnum.small)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue