mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +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(
|
result.push(
|
||||||
h("section.embedded-posts.bottom", [
|
h("section.embedded-posts.bottom", [
|
||||||
repliesBelow.map(p => {
|
repliesBelow.map(p => {
|
||||||
return this.attach("embedded-post", p, {
|
return this.attach("embedded-post", p, { model: p.asPost });
|
||||||
model: this.store.createRecord("post", p)
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
this.attach("button", {
|
this.attach("button", {
|
||||||
title: "post.collapse",
|
title: "post.collapse",
|
||||||
|
@ -449,8 +447,10 @@ createWidget("post-contents", {
|
||||||
.find("post-reply", { postId: this.attrs.id })
|
.find("post-reply", { postId: this.attrs.id })
|
||||||
.then(posts => {
|
.then(posts => {
|
||||||
this.state.repliesBelow = posts.map(p => {
|
this.state.repliesBelow = posts.map(p => {
|
||||||
p.shareUrl = `${topicUrl}/${p.post_number}`;
|
let result = transformWithCallbacks(p);
|
||||||
return 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) {
|
if (state.repliesAbove.length) {
|
||||||
const replies = state.repliesAbove.map(p => {
|
const replies = state.repliesAbove.map(p => {
|
||||||
return this.attach("embedded-post", p, {
|
return this.attach("embedded-post", p, {
|
||||||
model: this.store.createRecord("post", p),
|
model: p.asPost,
|
||||||
state: { above: true }
|
state: { above: true }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,8 @@ function postStreamTest(name, attrs) {
|
||||||
postStreamTest("basics", {
|
postStreamTest("basics", {
|
||||||
posts() {
|
posts() {
|
||||||
const site = this.container.lookup("site:main");
|
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 [
|
return [
|
||||||
Post.create({
|
Post.create({
|
||||||
topic,
|
topic,
|
||||||
|
@ -118,7 +119,8 @@ postStreamTest("basics", {
|
||||||
|
|
||||||
postStreamTest("deleted posts", {
|
postStreamTest("deleted posts", {
|
||||||
posts() {
|
posts() {
|
||||||
const topic = Topic.create({ details: { created_by: { id: 123 } } });
|
const topic = Topic.create();
|
||||||
|
topic.set("details.created_by", { id: 123 });
|
||||||
return [
|
return [
|
||||||
Post.create({
|
Post.create({
|
||||||
topic,
|
topic,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user