FIX: In case called during a test
This commit is contained in:
parent
652000a58b
commit
9fa384e1db
|
@ -145,11 +145,14 @@ function initializeWithApi(api) {
|
||||||
|
|
||||||
api.decorateWidget('post-contents:after-cooked', dec => {
|
api.decorateWidget('post-contents:after-cooked', dec => {
|
||||||
if (dec.attrs.post_number === 1) {
|
if (dec.attrs.post_number === 1) {
|
||||||
const topic = dec.getModel().get('topic');
|
const postModel = dec.getModel();
|
||||||
|
if (postModel) {
|
||||||
|
const topic = postModel.get('topic');
|
||||||
if (topic.get('accepted_answer')) {
|
if (topic.get('accepted_answer')) {
|
||||||
return dec.rawHtml(`<p class="solved">${topic.get('acceptedAnswerHtml')}</p>`);
|
return dec.rawHtml(`<p class="solved">${topic.get('acceptedAnswerHtml')}</p>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
api.attachWidgetAction('post', 'acceptAnswer', function() {
|
api.attachWidgetAction('post', 'acceptAnswer', function() {
|
||||||
|
|
Loading…
Reference in New Issue