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
|
||||
ageCold: function() {
|
||||
var createdAt, createdAtDays, daysSinceEpoch, lastPost, nowDays;
|
||||
if (!(lastPost = this.get('last_posted_at'))) return;
|
||||
var createdAt, daysSinceEpoch, lastPost, lastPostDays, nowDays;
|
||||
if (!(createdAt = this.get('created_at'))) return;
|
||||
if (!(lastPost = this.get('last_posted_at'))) lastPost = createdAt;
|
||||
daysSinceEpoch = function(dt) {
|
||||
// 1000 * 60 * 60 * 24 = days since epoch
|
||||
return dt.getTime() / 86400000;
|
||||
|
@ -122,14 +122,12 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
|
||||
// Show heat on age
|
||||
nowDays = daysSinceEpoch(new Date());
|
||||
createdAtDays = daysSinceEpoch(new Date(createdAt));
|
||||
if (daysSinceEpoch(new Date(lastPost)) > nowDays - 90) {
|
||||
if (createdAtDays < nowDays - 60) return 'coldmap-high';
|
||||
if (createdAtDays < nowDays - 30) return 'coldmap-med';
|
||||
if (createdAtDays < nowDays - 14) return 'coldmap-low';
|
||||
}
|
||||
lastPostDays = daysSinceEpoch(new Date(lastPost));
|
||||
if (nowDays - lastPostDays > 60) return 'coldmap-high';
|
||||
if (nowDays - lastPostDays > 30) return 'coldmap-med';
|
||||
if (nowDays - lastPostDays > 14) return 'coldmap-low';
|
||||
return null;
|
||||
}.property('age', 'created_at'),
|
||||
}.property('age', 'created_at', 'last_posted_at'),
|
||||
|
||||
viewsHeat: function() {
|
||||
var v = this.get('views');
|
||||
|
|
Loading…
Reference in New Issue