FIX: endless spinner when /categories is set to homepage and you click the home logo FIX: latest column should respect topic state for the current user (new, unread, etc.) FIX: post count should have heat colors applied based on like ratios FIX: Add "More" button at the bottom of the latest column UX: The topic count number in the categories panel should be slightly larger
34 lines
926 B
JavaScript
34 lines
926 B
JavaScript
import computed from 'ember-addons/ember-computed-decorators';
|
|
import { fmt } from 'discourse/lib/computed';
|
|
|
|
export default Ember.Object.extend({
|
|
tagName: "td",
|
|
|
|
@computed("topic.like_count", "topic.posts_count")
|
|
ratio(likeCount, postCount) {
|
|
const likes = parseFloat(likeCount);
|
|
const posts = parseFloat(postCount);
|
|
|
|
if (posts < 10) { return 0; }
|
|
|
|
return (likes || 0) / posts;
|
|
},
|
|
|
|
@computed("topic.replyCount", "ratioText")
|
|
title(count, ratio) {
|
|
return I18n.messageFormat('posts_likes_MF', { count, ratio }).trim();
|
|
},
|
|
|
|
@computed("ratio")
|
|
ratioText(ratio) {
|
|
const settings = this.siteSettings;
|
|
if (ratio > settings.topic_post_like_heat_high) { return 'high'; }
|
|
if (ratio > settings.topic_post_like_heat_medium) { return 'med'; }
|
|
if (ratio > settings.topic_post_like_heat_low) { return 'low'; }
|
|
return '';
|
|
},
|
|
|
|
likesHeat: fmt('ratioText', 'heatmap-%@'),
|
|
});
|
|
|