mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
[WO-629] Fix online status in desktop nav
This commit is contained in:
parent
571d9dbf34
commit
b10c0896e9
@ -242,19 +242,19 @@ var MailListCtrl = function($scope, $routeParams) {
|
||||
if (!searchText) {
|
||||
// set display buffer to first messages
|
||||
$scope.displayMessages = currentFolder().messages.slice(0, INIT_DISPLAY_LEN);
|
||||
$scope.searching = false;
|
||||
setSearching(false);
|
||||
updateStatus('Online');
|
||||
return;
|
||||
}
|
||||
|
||||
// display searching spinner
|
||||
$scope.searching = true;
|
||||
setSearching(true);
|
||||
updateStatus('Searching ...');
|
||||
searchTimeout = setTimeout(function() {
|
||||
$scope.$apply(function() {
|
||||
// filter relevant messages
|
||||
$scope.displayMessages = $scope.search(currentFolder().messages, searchText);
|
||||
$scope.searching = false;
|
||||
setSearching(false);
|
||||
updateStatus('Matches in this folder');
|
||||
});
|
||||
}, 500);
|
||||
@ -366,8 +366,12 @@ var MailListCtrl = function($scope, $routeParams) {
|
||||
}
|
||||
|
||||
function updateStatus(lbl, time) {
|
||||
$scope.lastUpdateLbl = lbl;
|
||||
$scope.lastUpdate = (time) ? time : '';
|
||||
$scope.state.mailList.lastUpdateLbl = lbl;
|
||||
$scope.state.mailList.lastUpdate = (time) ? time : '';
|
||||
}
|
||||
|
||||
function setSearching(state) {
|
||||
$scope.state.mailList.searching = state;
|
||||
}
|
||||
|
||||
function currentFolder() {
|
||||
|
@ -67,12 +67,12 @@
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<span class="spinner" ng-show="account.loggingIn || account.busy || searching"></span>
|
||||
<span class="spinner" ng-show="account.loggingIn || account.busy || state.mailList.searching"></span>
|
||||
<span class="text" ng-switch="account.online">
|
||||
<span ng-switch-when="false">
|
||||
<svg><use xlink:href="#icon-offline" /></svg>
|
||||
</span>
|
||||
{{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}}
|
||||
{{state.mailList.lastUpdateLbl}} {{state.mailList.lastUpdate | date:'shortTime'}}
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
@ -68,12 +68,12 @@
|
||||
</ul><!--/nav__secondary-->
|
||||
|
||||
<footer>
|
||||
<span class="spinner" ng-show="account.loggingIn || account.busy || searching"></span>
|
||||
<span class="spinner" ng-show="account.loggingIn || account.busy || state.mailList.searching"></span>
|
||||
<span class="text" ng-switch="account.online">
|
||||
<span ng-switch-when="false">
|
||||
<svg><use xlink:href="#icon-offline" /></svg>
|
||||
</span>
|
||||
{{lastUpdateLbl}} {{lastUpdate | date:'shortTime'}}
|
||||
{{state.mailList.lastUpdateLbl}} {{state.mailList.lastUpdate | date:'shortTime'}}
|
||||
</span>
|
||||
</footer>
|
||||
</nav>
|
@ -137,8 +137,8 @@ describe('Mail List controller unit test', function() {
|
||||
|
||||
it('should show initial message on empty', function() {
|
||||
scope.displaySearchResults();
|
||||
expect(scope.searching).to.be.false;
|
||||
expect(scope.lastUpdateLbl).to.equal('Online');
|
||||
expect(scope.state.mailList.searching).to.be.false;
|
||||
expect(scope.state.mailList.lastUpdateLbl).to.equal('Online');
|
||||
expect(scope.displayMessages.length).to.equal(2);
|
||||
});
|
||||
it('should show initial message on empty', function() {
|
||||
@ -147,13 +147,13 @@ describe('Mail List controller unit test', function() {
|
||||
|
||||
|
||||
scope.displaySearchResults('query');
|
||||
expect(scope.searching).to.be.true;
|
||||
expect(scope.lastUpdateLbl).to.equal('Searching ...');
|
||||
expect(scope.state.mailList.searching).to.be.true;
|
||||
expect(scope.state.mailList.lastUpdateLbl).to.equal('Searching ...');
|
||||
clock.tick(500);
|
||||
|
||||
expect(scope.displayMessages).to.deep.equal(['a']);
|
||||
expect(scope.searching).to.be.false;
|
||||
expect(scope.lastUpdateLbl).to.equal('Matches in this folder');
|
||||
expect(scope.state.mailList.searching).to.be.false;
|
||||
expect(scope.state.mailList.lastUpdateLbl).to.equal('Matches in this folder');
|
||||
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user