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>
</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>
Recent Activity
<i class="icon nav-item-arrow-right"></i>
@ -28,7 +28,7 @@
<ion-spinner icon="lines"></ion-spinner>
<div translate>Updating activity. Please stand by</div>
</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>
</a>
</div>

View File

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