Use `transformedPost` as args to the Post widget

This is necessary due to upcoming changes in the post model for the Glimmer post stream.
This commit is contained in:
Sérgio Saquetim 2025-03-18 01:45:06 -03:00
parent 9a7169a6df
commit b75801e721
No known key found for this signature in database
GPG Key ID: B4E3D7F11E793062
1 changed files with 13 additions and 4 deletions

View File

@ -1,21 +1,30 @@
import Component from "@ember/component";
import { reads } from "@ember/object/computed";
import { service } from "@ember/service";
import { classNames } from "@ember-decorators/component";
import discourseDebounce from "discourse/lib/debounce";
import computed, { bind } from "discourse/lib/decorators";
import transformPost from "discourse/lib/transform-post";
import { currentUser } from "discourse/tests/helpers/qunit-helpers";
@classNames("docs-topic")
export default class DocsTopic extends Component {
@service currentUser;
@service site;
@reads("post.cooked") originalPostContent;
@computed("topic.post_stream")
@computed("currentUser", "model")
post(stream) {
return this.store.createRecord("post", stream?.posts.firstObject);
return transformPost(this.currentUser, this.site, this.model);
}
@computed("post", "topic")
@computed("topic", "topic.post_stream")
model() {
const post = this.post;
const post = this.store.createRecord(
"post",
this.topic.post_stream?.posts.firstObject
);
if (!post.topic) {
post.set("topic", this.topic);