Skip to content

Node.js based forum software built for the modern web

closes #6883

Barış Soner Uşaklı2e579ee0f972
diff --git a/install/data/defaults.json b/install/data/defaults.json
index d08ad93763..161f4efe4e 100644
--- a/install/data/defaults.json
+++ b/install/data/defaults.json
@@ -111,5 +111,6 @@
"hsts-preload": 0,
"hsts-enabled": 0,
"eventLoopLagThreshold": 100,
- "eventLoopInterval": 500
+ "eventLoopInterval": 500,
+ "onlineCutoff": 30
}
\ No newline at end of file
diff --git a/public/language/en-GB/admin/settings/user.json b/public/language/en-GB/admin/settings/user.json
index 501441aa64..a6a6f26af4 100644
--- a/public/language/en-GB/admin/settings/user.json
+++ b/public/language/en-GB/admin/settings/user.json
@@ -27,6 +27,8 @@
"lockout-duration": "Account Lockout Duration (minutes)",
"login-days": "Days to remember user login sessions",
"password-expiry-days": "Force password reset after a set number of days",
+ "online-cutoff": "Minutes after user is considered inactive",
+ "online-cutoff-help": "If user performs no actions for this duration, they are considered inactive and they do not receive realtime updates.",
"registration": "User Registration",
"registration-type": "Registration Type",
"registration-type.normal": "Normal",
diff --git a/src/user/index.js b/src/user/index.js
index d3fc8cc85a..9992c0b9d1 100644
--- a/src/user/index.js
+++ b/src/user/index.js
@@ -43,7 +43,7 @@ User.getUidsFromSet = function (set, start, stop, callback) {
if (set === 'users:online') {
var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1;
var now = Date.now();
- db.getSortedSetRevRangeByScore(set, start, count, '+inf', now - 300000, callback);
+ db.getSortedSetRevRangeByScore(set, start, count, '+inf', now - (meta.config.onlineCutoff * 60000), callback);
} else {
db.getSortedSetRevRange(set, start, stop, callback);
}
diff --git a/src/views/admin/settings/user.tpl b/src/views/admin/settings/user.tpl
index 882f567cfb..2118cf4a00 100644
--- a/src/views/admin/settings/user.tpl
+++ b/src/views/admin/settings/user.tpl
@@ -144,6 +144,9 @@
<input type="text" class="form-control" data-field="loginSeconds" placeholder="Seconds" />
<p class="help-block">Note that only one of these values will be used. If there is no <i>seconds</i> value we fall back to <i>days</i>. If
there is no <i>days</i> value we default to <i>14 days</i>.</p>
+ <label>[[admin/settings/user:online-cutoff]]</label>
+ <input type="text" class="form-control" data-field="onlineCutoff">
+ <p class="help-block">[[admin/settings/user:online-cutoff-help]]</p>
</div>
</form>
</div>