diff --git a/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 b/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 index e6b70ab2126..9d3cded17fe 100644 --- a/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 @@ -1,33 +1,17 @@ import Component from "@ember/component"; -import { bufferedRender } from "discourse-common/lib/buffered-render"; -// Creates a link -function link(buffer, prop, url, cssClass, i18nKey, text) { - if (!prop) { - return; +export default Component.extend({ + tagName: "span", + classNameBindings: [":topic-post-badges"], + rerenderTriggers: ["url", "unread", "newPosts", "unseen"], + newDotText: null, + init() { + this._super(...arguments); + this.set( + "newDotText", + this.currentUser && this.currentUser.trust_level > 0 + ? " " + : I18n.t("filters.new.lower_title") + ); } - const title = I18n.t("topic." + i18nKey, { count: prop }); - buffer.push( - `${text || - prop}\n` - ); -} - -export default Component.extend( - bufferedRender({ - tagName: "span", - classNameBindings: [":topic-post-badges"], - rerenderTriggers: ["url", "unread", "newPosts", "unseen"], - - buildBuffer(buffer) { - const newDotText = - this.currentUser && this.currentUser.trust_level > 0 - ? " " - : I18n.t("filters.new.lower_title"); - const url = this.url; - link(buffer, this.unread, url, "unread", "unread_posts"); - link(buffer, this.newPosts, url, "new-posts", "new_posts"); - link(buffer, this.unseen, url, "new-topic", "new", newDotText); - } - }) -); +}); diff --git a/app/assets/javascripts/discourse/templates/components/topic-post-badges.hbs b/app/assets/javascripts/discourse/templates/components/topic-post-badges.hbs new file mode 100644 index 00000000000..0953efa293b --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/topic-post-badges.hbs @@ -0,0 +1,9 @@ +{{#if unread }} +  {{unread}} +{{/if}} +{{#if newPosts}} +  {{newPosts}} +{{/if}} +{{#if unseen}} +  {{newDotText}} +{{/if}}