-
+
+ {{#if this.isLongPost}}
+
+ {{/if}}
+
{{yield}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js
index d06ddf3c1c5..6bd74bdbe73 100644
--- a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js
+++ b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js
@@ -1,11 +1,51 @@
-import Component from "@ember/component";
+import Component from "@glimmer/component";
+import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import showModal from "discourse/lib/show-modal";
-export default Component.extend({
+export default class ReviewableQueuedPost extends Component {
+ @tracked isCollapsed = false;
+ @tracked isLongPost = false;
+ @tracked postBodyHeight = 0;
+ maxPostHeight = 300;
+
@action
showRawEmail(event) {
event?.preventDefault();
- showModal("raw-email").set("rawEmail", this.reviewable.payload.raw_email);
- },
-});
+ showModal("raw-email").set(
+ "rawEmail",
+ this.args.reviewable.payload.raw_email
+ );
+ }
+
+ @action
+ toggleContent() {
+ this.isCollapsed = !this.isCollapsed;
+ }
+
+ get collapseButtonProps() {
+ if (this.isCollapsed) {
+ return {
+ label: "review.show_more",
+ icon: "chevron-down",
+ };
+ }
+ return {
+ label: "review.show_less",
+ icon: "chevron-up",
+ };
+ }
+
+ @action
+ setPostBodyHeight(offsetHeight) {
+ this.postBodyHeight = offsetHeight;
+
+ if (this.postBodyHeight > this.maxPostHeight) {
+ this.isCollapsed = true;
+ this.isLongPost = true;
+ } else {
+ this.isCollapsed = false;
+ this.isLongPost = false;
+ }
+ }
+}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
index 15d648f2cb7..001aad6e7a9 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js
@@ -14,7 +14,7 @@ module("Integration | Component | cook-text", function (hooks) {
});
test("renders markdown", async function (assert) {
- await render(hbs`