mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:21:55 +08:00
FIX: supports emojis in pinned topic excerpt
This commit is contained in:
parent
c9912fcc37
commit
dd27c0c80e
|
@ -407,6 +407,10 @@ const Topic = RestModel.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed('excerpt')
|
||||
escapedExcerpt(excerpt) {
|
||||
return emojiUnescape(excerpt);
|
||||
},
|
||||
|
||||
hasExcerpt: Em.computed.notEmpty('excerpt'),
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{#if topic.hasExcerpt}}
|
||||
<div class="topic-excerpt">
|
||||
{{{topic.excerpt}}}
|
||||
{{{topic.escapedExcerpt}}}
|
||||
{{#if topic.excerptTruncated}}
|
||||
<a href="{{topic.url}}">{{i18n 'read_more'}}</a>
|
||||
{{/if}}
|
||||
|
|
|
@ -75,3 +75,11 @@ QUnit.test('fancyTitle', assert => {
|
|||
`<img src='/images/emoji/emoji_one/smile.png?v=${v}' title='smile' alt='smile' class='emoji'> with all <img src='/images/emoji/emoji_one/slight_smile.png?v=${v}' title='slight_smile' alt='slight_smile' class='emoji'> the emojis <img src='/images/emoji/emoji_one/pear.png?v=${v}' title='pear' alt='pear' class='emoji'><img src='/images/emoji/emoji_one/peach.png?v=${v}' title='peach' alt='peach' class='emoji'>`,
|
||||
"supports emojis");
|
||||
});
|
||||
|
||||
QUnit.test('excerpt', assert => {
|
||||
var topic = Topic.create({ excerpt: "This is a test topic :smile:", pinned: true });
|
||||
|
||||
assert.equal(topic.get('escapedExcerpt'),
|
||||
`This is a test topic <img src='/images/emoji/emoji_one/smile.png?v=${v}' title='smile' alt='smile' class='emoji'>`,
|
||||
"supports emojis");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user