Refactoring codes

refs: https://github.com/syuilo/misskey/pull/3117#pullrequestreview-171437187
This commit is contained in:
Acid Chicken (硫酸鶏) 2018-11-05 17:04:17 +09:00 committed by GitHub
parent 31b7626d01
commit 54e9147782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,10 +37,10 @@ export default Vue.extend({
methods: { methods: {
exec() { exec() {
const { emoji, raw, customEmojis } = this; const { emoji, raw, customEmojis } = this;
this.name = emoji || raw; this.name = emoji ? `:${emoji}:` : raw;
if (!raw && customEmojis && customEmojis.length) if (!raw && customEmojis && customEmojis.length) {
this.url = customEmojis.find(x => findCustomEmoji(x, emoji)).url; this.url = customEmojis.find(x => findCustomEmoji(x, emoji)).url;
if (!this.url) { } else { // *MEM: `customEmojis` always has a emoji named `emoji`
const char = raw || lib[emoji] && lib[emoji].char; const char = raw || lib[emoji] && lib[emoji].char;
if (char) { if (char) {
this.url = `https://twemoji.maxcdn.com/2/svg/${char.codePointAt(0).toString(16)}.svg`; this.url = `https://twemoji.maxcdn.com/2/svg/${char.codePointAt(0).toString(16)}.svg`;