Commit 9f0354990d92384a0a2d222469e672f428402bfd
Fix render crash on wierd mentions
Anders Rune Jensen committed on 12/18/2017, 9:13:19 PMParent: 2dcdef60a24ea6a888eee961f4c90e89cc87ca94
Files changed
render.js | changed |
render.js | ||
---|---|---|
@@ -32,9 +32,9 @@ | ||
32 | 32 … | return this.opts.base + "channel/" + href.slice(1); |
33 | 33 … | case "%": |
34 | 34 … | return this.opts.msg_base + encodeURIComponent(href); |
35 | 35 … | case "@": |
36 | - href = this.opts.mentions[href.substr(1)] || href; | |
36 … | + href = (this.opts.mentions && this.opts.mentions[href.substr(1)]) || href; | |
37 | 37 … | return this.opts.feed_base + encodeURIComponent(href); |
38 | 38 … | case "&": |
39 | 39 … | return this.opts.blob_base + encodeURIComponent(href); |
40 | 40 … | } |
@@ -57,11 +57,10 @@ | ||
57 | 57 … | }; |
58 | 58 … | |
59 | 59 … | function renderEmoji(emoji) { |
60 | 60 … | var opts = this.renderer.opts; |
61 | - var mentions = opts.mentions; | |
62 | - var url = mentions[emoji] | |
63 | - ? opts.blob_base + encodeURIComponent(mentions[emoji]) | |
61 … | + var url = opts.mentions[emoji] | |
62 … | + ? opts.blob_base + encodeURIComponent(opts.mentions[emoji]) | |
64 | 63 … | : emoji in emojis && opts.emoji_base + escape(emoji) + '.png'; |
65 | 64 … | return url |
66 | 65 … | ? h('img.ssb-emoji', |
67 | 66 … | { src: url, |
Built with git-ssb-web