summaryrefslogtreecommitdiffstats
path: root/js/public
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-05 14:27:14 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-05 14:27:14 +0200
commit685ff350eb6c91fd8f48d31a4ba6a815d5f6e403 (patch)
tree0ee3336fc8f0ea60bf71275d3be4f9faea5784db /js/public
parent1df9491ac0568ece09d4836b6296346cf51c75fa (diff)
reduce unreadcount instantly when marking as read, fixes #7
Diffstat (limited to 'js/public')
-rw-r--r--js/public/app.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/js/public/app.js b/js/public/app.js
index 9c340462f..a70e513a4 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -863,20 +863,28 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
ItemBl.prototype.setRead = function(itemId) {
- var item;
+ var feed, item;
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
item.setRead();
- return this._persistence.readItem(itemId);
+ this._persistence.readItem(itemId);
+ feed = this._feedModel.getById(item.feedId);
+ if (angular.isDefined(feed)) {
+ return feed.unreadCount -= 1;
+ }
}
};
ItemBl.prototype.setUnread = function(itemId) {
- var item;
+ var feed, item;
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
item.setUnread();
- return this._persistence.unreadItem(itemId);
+ this._persistence.unreadItem(itemId);
+ feed = this._feedModel.getById(item.feedId);
+ if (angular.isDefined(feed)) {
+ return feed.unreadCount += 1;
+ }
}
};