Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions javascripts/discourse/initializers/below-op.gjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Component from "@glimmer/component";
import { withSilencedDeprecations } from "discourse/lib/deprecated";
import { withPluginApi } from "discourse/lib/plugin-api";
import RenderGlimmer from "discourse/widgets/render-glimmer";
import { hbs } from "ember-cli-htmlbars";
import FirstReplyStatement from "../components/first-reply-statement";

function firstReplyPost(api) {
Expand Down Expand Up @@ -54,59 +51,6 @@ function firstReplyPost(api) {
</template>
}
);

// wrap the old widget code silencing the deprecation warnings
withSilencedDeprecations("discourse.post-stream-widget-overrides", () =>
firstReplyPostOld(api)
);
}

function firstReplyPostOld(api) {
api.decorateWidget("post:after", function (helper) {
const model = helper.getModel();
const topic = model.topic;

// Private message check
if (topic.archetype === "private_message") {
return;
}

// Only appear after the first post
if (model.post_number !== 1) {
return;
}

// Disabled categories check
if (settings.disabled_categories) {
const categoriesId = settings.disabled_categories
.split("|")
.map((id) => parseInt(id, 10));
if (categoriesId.includes(topic.category_id)) {
return;
}
}

// Only show if this is the only post and can be replied to
if (topic.posts_count !== 1) {
return;
}

if (!topic.details?.can_create_post) {
return;
}

return [
new RenderGlimmer(
helper.widget,
"div.first-reply-statement-wrapper",
hbs`<FirstReplyStatement @outletArgs={{@data}}/>`,
{
model: topic,
belowOP: true,
}
),
];
});
}

export default {
Expand Down