Merge pull request #77 from JDonadio/fix/notifications

Fix notifications shown
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-07 15:15:55 -03:00 committed by GitHub
commit 413c1fc8a3
2 changed files with 19 additions and 7 deletions

View file

@ -19,7 +19,7 @@
</a> </a>
</div> </div>
<div class="list card"> <div class="list card" ng-if="notifications[0]">
<a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate> <a class="item item-icon-right item-heading" ui-sref="tabs.activity" translate>
Recent Activity Recent Activity
<i class="icon nav-item-arrow-right"></i> <i class="icon nav-item-arrow-right"></i>
@ -28,7 +28,7 @@
<ion-spinner icon="lines"></ion-spinner> <ion-spinner icon="lines"></ion-spinner>
<div translate>Updating activity. Please stand by</div> <div translate>Updating activity. Please stand by</div>
</span> </span>
<a ng-if="notifications[0]" class="item" ng-repeat="x in notifications" ng-click="x.action()"> <a class="item" ng-repeat="x in notifications" ng-click="x.action()">
<span ng-include="'views/includes/walletActivity.html'"></span> <span ng-include="'views/includes/walletActivity.html'"></span>
</a> </a>
</div> </div>

View file

@ -762,7 +762,7 @@ angular.module('copayApp.services')
var TIME_STAMP = 60 * 60 * 24 * 7; var TIME_STAMP = 60 * 60 * 24 * 7;
var MAX = 100; var MAX = 100;
var ignored = { var typeFilter1 = {
'NewBlock': 1, 'NewBlock': 1,
'BalanceUpdated': 1, 'BalanceUpdated': 1,
'NewOutgoingTxByThirdParty': 1, 'NewOutgoingTxByThirdParty': 1,
@ -771,6 +771,12 @@ angular.module('copayApp.services')
'TxProposalFinallyRejected': 1, 'TxProposalFinallyRejected': 1,
}; };
var typeFilter2 = {
'TxProposalAcceptedBy': 1,
'TxProposalRejectedBy': 1,
'NewTxProposal': 1,
}
var w = root.getWallets(); var w = root.getWallets();
if (lodash.isEmpty(w)) return cb(); if (lodash.isEmpty(w)) return cb();
@ -868,9 +874,15 @@ angular.module('copayApp.services')
$log.warn('Error updating notifications:' + err); $log.warn('Error updating notifications:' + err);
} else { } else {
var n = lodash.filter(wallet.cachedActivity.n, function(x) { var n = lodash.filter(wallet.cachedActivity.n, function(x) {
return !ignored[x.type]; return !typeFilter1[x.type];
}); });
if (wallet.n == 1) {
var n = lodash.filter(n, function(x) {
return !typeFilter2[x.type];
});
}
var idToName = {}; var idToName = {};
if (wallet.cachedStatus) { if (wallet.cachedStatus) {
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) { lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {