Clean up updateShowNicklist()
This commit is contained in:
parent
66c8c53b41
commit
fe3b975c6e
1 changed files with 18 additions and 19 deletions
|
@ -768,25 +768,24 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
// certain swipe actions. Sets $scope.showNicklist accordingly and returns
|
// certain swipe actions. Sets $scope.showNicklist accordingly and returns
|
||||||
// whether the buffer even has a nicklist to show.
|
// whether the buffer even has a nicklist to show.
|
||||||
$scope.updateShowNicklist = function() {
|
$scope.updateShowNicklist = function() {
|
||||||
// returns array of booleans: [show nicklist, buffer has nicklist]
|
|
||||||
var result = (function() {
|
|
||||||
var ab = models.getActiveBuffer();
|
var ab = models.getActiveBuffer();
|
||||||
// Check whether buffer exists and nicklist is non-empty
|
// Check whether buffer exists and nicklist is non-empty
|
||||||
if (!ab || ab.isNicklistEmpty()) {
|
if (!ab || ab.isNicklistEmpty()) {
|
||||||
return [false, false];
|
$scope.showNicklist = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// Check if nicklist is disabled in settings (ignored on mobile)
|
// Check if nicklist is disabled in settings (ignored on mobile)
|
||||||
if (!utils.isMobileUi() && settings.nonicklist) {
|
if (!utils.isMobileUi() && settings.nonicklist) {
|
||||||
return [false, true];
|
$scope.showNicklist = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
// mobile: hide nicklist unless overriden by setting or swipe action
|
// mobile: hide nicklist unless overriden by setting or swipe action
|
||||||
if (utils.isMobileUi() && !settings.alwaysnicklist && $scope.swipeStatus !== -1) {
|
if (utils.isMobileUi() && !settings.alwaysnicklist && $scope.swipeStatus !== -1) {
|
||||||
return [false, true];
|
$scope.showNicklist = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return [true, true];
|
$scope.showNicklist = true;
|
||||||
})();
|
return true;
|
||||||
$scope.showNicklist = result[0];
|
|
||||||
return result[1];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//XXX not sure whether this belongs here
|
//XXX not sure whether this belongs here
|
||||||
|
|
Loading…
Reference in a new issue