FIX: Incorrect model for embedded post widget.
This commit is contained in:
parent
fc9cfd698d
commit
63b8797667
|
@ -19,7 +19,7 @@ export function includeAttributes(...attributes) {
|
||||||
export function transformBasicPost(post) {
|
export function transformBasicPost(post) {
|
||||||
// Note: it can be dangerous to not use `get` in Ember code, but this is significantly
|
// Note: it can be dangerous to not use `get` in Ember code, but this is significantly
|
||||||
// faster and has tests to confirm it works. We only call `get` when the property is a CP
|
// faster and has tests to confirm it works. We only call `get` when the property is a CP
|
||||||
return {
|
const postAtts = {
|
||||||
id: post.id,
|
id: post.id,
|
||||||
hidden: post.hidden,
|
hidden: post.hidden,
|
||||||
deleted: post.get('deleted'),
|
deleted: post.get('deleted'),
|
||||||
|
@ -73,6 +73,9 @@ export function transformBasicPost(post) {
|
||||||
replyCount: post.reply_count,
|
replyCount: post.reply_count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_additionalAttributes.forEach(a => postAtts[a] = post[a]);
|
||||||
|
|
||||||
|
return postAtts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,9 @@ createWidget('post-contents', {
|
||||||
|
|
||||||
const repliesBelow = state.repliesBelow;
|
const repliesBelow = state.repliesBelow;
|
||||||
if (repliesBelow.length) {
|
if (repliesBelow.length) {
|
||||||
result.push(h('section.embedded-posts.bottom', repliesBelow.map(p => this.attach('embedded-post', p))));
|
result.push(h('section.embedded-posts.bottom', repliesBelow.map(p => {
|
||||||
|
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p) });
|
||||||
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -339,7 +341,10 @@ createWidget('post-article', {
|
||||||
html(attrs, state) {
|
html(attrs, state) {
|
||||||
const rows = [h('a.tabLoc', { attributes: { href: ''} })];
|
const rows = [h('a.tabLoc', { attributes: { href: ''} })];
|
||||||
if (state.repliesAbove.length) {
|
if (state.repliesAbove.length) {
|
||||||
const replies = state.repliesAbove.map(p => this.attach('embedded-post', p, { state: { above: true } }));
|
const replies = state.repliesAbove.map(p => {
|
||||||
|
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p), state: { above: true } });
|
||||||
|
});
|
||||||
|
|
||||||
rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', replies)));
|
rows.push(h('div.row', h('section.embedded-posts.top.topic-body.offset2', replies)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ function initializePolls(api) {
|
||||||
_pollViews = postPollViews;
|
_pollViews = postPollViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.includePostAttributes("polls", "polls_votes");
|
||||||
api.decorateCooked(createPollViews, { onlyStream: true });
|
api.decorateCooked(createPollViews, { onlyStream: true });
|
||||||
api.cleanupStream(cleanUpPollViews);
|
api.cleanupStream(cleanUpPollViews);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue