Fix cold colours in activity column of topic lists
This commit is contained in:
parent
564a7e505e
commit
5f46ce7329
|
@ -112,9 +112,9 @@ Discourse.Topic = Discourse.Model.extend({
|
||||||
|
|
||||||
// The coldmap class for the age of the topic
|
// The coldmap class for the age of the topic
|
||||||
ageCold: function() {
|
ageCold: function() {
|
||||||
var createdAt, createdAtDays, daysSinceEpoch, lastPost, nowDays;
|
var createdAt, daysSinceEpoch, lastPost, lastPostDays, nowDays;
|
||||||
if (!(lastPost = this.get('last_posted_at'))) return;
|
|
||||||
if (!(createdAt = this.get('created_at'))) return;
|
if (!(createdAt = this.get('created_at'))) return;
|
||||||
|
if (!(lastPost = this.get('last_posted_at'))) lastPost = createdAt;
|
||||||
daysSinceEpoch = function(dt) {
|
daysSinceEpoch = function(dt) {
|
||||||
// 1000 * 60 * 60 * 24 = days since epoch
|
// 1000 * 60 * 60 * 24 = days since epoch
|
||||||
return dt.getTime() / 86400000;
|
return dt.getTime() / 86400000;
|
||||||
|
@ -122,14 +122,12 @@ Discourse.Topic = Discourse.Model.extend({
|
||||||
|
|
||||||
// Show heat on age
|
// Show heat on age
|
||||||
nowDays = daysSinceEpoch(new Date());
|
nowDays = daysSinceEpoch(new Date());
|
||||||
createdAtDays = daysSinceEpoch(new Date(createdAt));
|
lastPostDays = daysSinceEpoch(new Date(lastPost));
|
||||||
if (daysSinceEpoch(new Date(lastPost)) > nowDays - 90) {
|
if (nowDays - lastPostDays > 60) return 'coldmap-high';
|
||||||
if (createdAtDays < nowDays - 60) return 'coldmap-high';
|
if (nowDays - lastPostDays > 30) return 'coldmap-med';
|
||||||
if (createdAtDays < nowDays - 30) return 'coldmap-med';
|
if (nowDays - lastPostDays > 14) return 'coldmap-low';
|
||||||
if (createdAtDays < nowDays - 14) return 'coldmap-low';
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}.property('age', 'created_at'),
|
}.property('age', 'created_at', 'last_posted_at'),
|
||||||
|
|
||||||
viewsHeat: function() {
|
viewsHeat: function() {
|
||||||
var v = this.get('views');
|
var v = this.get('views');
|
||||||
|
|
Loading…
Reference in New Issue