From 7861cabfa196671097bc1af15d504ce21c694026 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Sat, 31 May 2014 10:19:29 +1000
Subject: [PATCH] FEATURE: posts per page is configurable, so should be desktop
 slack

---
 app/assets/javascripts/discourse/lib/capabilities.js | 7 +++++--
 config/locales/server.en.yml                         | 1 +
 config/site_settings.yml                             | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/app/assets/javascripts/discourse/lib/capabilities.js b/app/assets/javascripts/discourse/lib/capabilities.js
index 4943179f5..d94b3da4d 100644
--- a/app/assets/javascripts/discourse/lib/capabilities.js
+++ b/app/assets/javascripts/discourse/lib/capabilities.js
@@ -19,12 +19,15 @@ Discourse.Capabilities = Ember.Object.extend({
     // Touch devices get more slack due to inertia
     if (this.get('touch')) { return 1.5; }
 
+    var desktopSlack = parseFloat(Discourse.SiteSettings.desktop_post_slack_ratio,10);
+    desktopSlack = Math.max(desktopSlack,1);
+
     // Higher resolution devices (likely laptops/desktops) should get more slack because they
     // can handle the perf.
-    return this.get('highRes') ? 2.0 : 0.75;
+    return this.get('highRes') ? desktopSlack : 0.75;
 
   }.property('android', 'touch', 'highRes')
 
 });
 
-Discourse.Capabilities.reopenClass(Discourse.Singleton);
\ No newline at end of file
+Discourse.Capabilities.reopenClass(Discourse.Singleton);
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index bc5c3170f..42dd45ca2 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -682,6 +682,7 @@ en:
     track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs"
     topics_per_page: "How many topics loaded by default on the topics list page, and when loading more topics"
     posts_per_page: "How many posts loaded by default on a topic page, and when loading more posts"
+    desktop_post_slack_ratio: "Number of screens of posts rendered in the DOM on Desktop"
     site_contact_username: "Username for the author of automated private messages sent by the forum"
     send_welcome_message: "Do new users get a welcome private message?"
     suppress_reply_directly_below: "Don't show reply count on a post when there is a single reply directly below"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 689bd0d05..098af1310 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -85,6 +85,9 @@ basic:
   posts_per_page:
     client: true
     default: 20
+  desktop_post_slack_ratio:
+    default: 2
+    client: true
   enable_badges:
     client: true
     default: false