Use Site Settings for the cold date ranges

This commit is contained in:
Robin Ward 2014-08-15 12:09:31 -04:00
parent 26ca197be9
commit 2f4f5d56e1
4 changed files with 25 additions and 9 deletions

View File

@ -26,9 +26,9 @@ export default Ember.Component.extend({
if (!bumpedAt) { return; }
var delta = daysSinceEpoch(bumpedAt) - daysSinceEpoch(createdAt);
if (delta > 120) { return 'coldmap-high'; }
if (delta > 60) { return 'coldmap-med'; }
if (delta > 14) { return 'coldmap-low'; }
if (delta > Discourse.SiteSettings.cold_age_days_high) { return 'coldmap-high'; }
if (delta > Discourse.SiteSettings.cold_age_days_medium) { return 'coldmap-med'; }
if (delta > Discourse.SiteSettings.cold_age_days_low) { return 'coldmap-low'; }
}.property('bumpedAt', 'createdAt'),
title: function() {

View File

@ -14,9 +14,10 @@ function coldAgeClass(property, options) {
// Show heat on age
var nowDays = daysSinceEpoch(new Date()),
epochDays = daysSinceEpoch(new Date(dt));
if (nowDays - epochDays > 60) return 'age coldmap-high';
if (nowDays - epochDays > 30) return 'age coldmap-med';
if (nowDays - epochDays > 14) return 'age coldmap-low';
if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_high) return 'age coldmap-high';
if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_medium) return 'age coldmap-med';
if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_low) return 'age coldmap-low';
return 'age';
}

View File

@ -890,9 +890,13 @@ en:
topic_views_heat_medium: "After this many views, the topic is moderately highlighted."
topic_views_heat_high: "After this many views, the topic is strongly highlighted."
topic_post_like_heat_low: "A post with this likes:post ratio is slightly highlighted."
topic_post_like_heat_medium: "A post with this likes:post ratio is slightly highlighted."
topic_post_like_heat_high: "A post with this likes:post ratio is slightly highlighted."
cold_age_days_low: "A topic this many days old is slightly highligted."
cold_age_days_medium: "A topic this many days old is slightly highligted."
cold_age_days_high: "A topic this many days old is slightly highligted."
topic_post_like_heat_low: "A topic with this likes:post ratio is slightly highlighted."
topic_post_like_heat_medium: "A topic with this likes:post ratio is slightly highlighted."
topic_post_like_heat_high: "A topic with this likes:post ratio is slightly highlighted."
faq_url: "If you have a FAQ hosted elsewhere that you want to use, provide the full URL here."
tos_url: "If you have a Terms of Service document hosted elsewhere that you want to use, provide the full URL here."

View File

@ -681,6 +681,17 @@ uncategorized:
client: true
default: 2.0
# Cold map thresholds
cold_age_days_low:
client: true
default: 14
cold_age_days_medium:
client: true
default: 60
cold_age_days_high:
client: true
default: 120
# Warnings
educate_until_posts: 2
sequential_replies_threshold: 2