mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:16:08 +08:00
FIX: Overwriting more computed properties
This commit is contained in:
parent
01cd371be5
commit
766cb24989
|
@ -407,9 +407,7 @@ createWidget("post-contents", {
|
|||
result.push(
|
||||
h("section.embedded-posts.bottom", [
|
||||
repliesBelow.map(p => {
|
||||
return this.attach("embedded-post", p, {
|
||||
model: this.store.createRecord("post", p)
|
||||
});
|
||||
return this.attach("embedded-post", p, { model: p.asPost });
|
||||
}),
|
||||
this.attach("button", {
|
||||
title: "post.collapse",
|
||||
|
@ -449,8 +447,10 @@ createWidget("post-contents", {
|
|||
.find("post-reply", { postId: this.attrs.id })
|
||||
.then(posts => {
|
||||
this.state.repliesBelow = posts.map(p => {
|
||||
p.shareUrl = `${topicUrl}/${p.post_number}`;
|
||||
return transformWithCallbacks(p);
|
||||
let result = transformWithCallbacks(p);
|
||||
result.shareUrl = `${topicUrl}/${p.post_number}`;
|
||||
result.asPost = this.store.createRecord("post", p);
|
||||
return result;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -565,7 +565,7 @@ createWidget("post-article", {
|
|||
if (state.repliesAbove.length) {
|
||||
const replies = state.repliesAbove.map(p => {
|
||||
return this.attach("embedded-post", p, {
|
||||
model: this.store.createRecord("post", p),
|
||||
model: p.asPost,
|
||||
state: { above: true }
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,7 +20,8 @@ function postStreamTest(name, attrs) {
|
|||
postStreamTest("basics", {
|
||||
posts() {
|
||||
const site = this.container.lookup("site:main");
|
||||
const topic = Topic.create({ details: { created_by: { id: 123 } } });
|
||||
const topic = Topic.create();
|
||||
topic.set("details.created_by", { id: 123 });
|
||||
return [
|
||||
Post.create({
|
||||
topic,
|
||||
|
@ -118,7 +119,8 @@ postStreamTest("basics", {
|
|||
|
||||
postStreamTest("deleted posts", {
|
||||
posts() {
|
||||
const topic = Topic.create({ details: { created_by: { id: 123 } } });
|
||||
const topic = Topic.create();
|
||||
topic.set("details.created_by", { id: 123 });
|
||||
return [
|
||||
Post.create({
|
||||
topic,
|
||||
|
|
Loading…
Reference in New Issue
Block a user