A platform for community discussion. Free, open, simple.
DEV: Remove buffered rendering from topic-post-badges
Blake Ericksonea6326c860bc
diff --git a/app/assets/javascripts/discourse/components/topic-post-badges.js.es6 b/app/assets/javascripts/discourse/components/topic-post-badges.js.es6index 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(- `<a href="${url}" class="badge ${cssClass} badge-notification" title="${title}">${text ||- prop}</a>\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.hbsnew file mode 100644index 00000000000..0953efa293b--- /dev/null+++ b/app/assets/javascripts/discourse/templates/components/topic-post-badges.hbs@@ -0,0 +1,9 @@+{{#if unread }}+ <a href='{{url}}' class='badge badge-notification unread' title='{{i18n "topic.unread_posts" count=unread}}'>{{unread}}</a>+{{/if}}+{{#if newPosts}}+ <a href='{{url}}' class='badge badge-notification new-posts' title='{{i18n "topic.total_unread_posts" count=newPosts}}'>{{newPosts}}</a>+{{/if}}+{{#if unseen}}+ <a href='{{url}}' class='badge badge-notification new-topic' title='{{i18n "topic.new"}}'>{{newDotText}}</a>+{{/if}}