From 470897eadc1a249da1c285d1369facf03442489d Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 1 Sep 2016 23:42:15 -0600 Subject: [PATCH] Hopefully real fix to #88 with new StatLog ability --- mods/last_callers.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mods/last_callers.js b/mods/last_callers.js index 5f9b49b0..ccb8f804 100644 --- a/mods/last_callers.js +++ b/mods/last_callers.js @@ -67,15 +67,29 @@ LastCallersModule.prototype.mciReady = function(mciData, cb) { function fetchHistory(callback) { callersView = vc.getView(MciCodeIds.CallerList); - StatLog.getSystemLogEntries('user_login_history', StatLog.Order.TimestampDesc, callersView.dimens.height, (err, lh) => { + // fetch up + StatLog.getSystemLogEntries('user_login_history', StatLog.Order.TimestampDesc, 200, (err, lh) => { loginHistory = lh; if(self.menuConfig.config.hideSysOpLogin) { - loginHistory = loginHistory.filter(lh => { + const noOpLoginHistory = loginHistory.filter(lh => { return false === isRootUserId(parseInt(lh.log_value)); // log_value=userId }); - } + // + // If we have enough items to display, or hideSysOpLogin is set to 'always', + // then set loginHistory to our filtered list. Else, we'll leave it be. + // + if(noOpLoginHistory.length >= callersView.dimens.height || 'always' === self.menuConfig.config.hideSysOpLogin) { + loginHistory = noOpLoginHistory; + } + } + + // + // Finally, we need to trim up the list to the needed size + // + loginHistory = loginHistory.slice(0, callersView.dimens.height); + return callback(err); }); },