diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-05 23:53:56 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-05 23:53:56 +0200 |
commit | 4b169b4561dd752cfe717e17a66bc3cf61f7627d (patch) | |
tree | c86aa0a46dce64dc563199c932c6c68b81d76e8d /js/app/services | |
parent | 7f2cc571f6f4c5e96ab2b79f359958eceea0acbc (diff) |
dont allow setting read and unread if it doesnt change the status
Diffstat (limited to 'js/app/services')
-rw-r--r-- | js/app/services/bl/itembl.coffee | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/js/app/services/bl/itembl.coffee b/js/app/services/bl/itembl.coffee index eb50b8d55..6a09400af 100644 --- a/js/app/services/bl/itembl.coffee +++ b/js/app/services/bl/itembl.coffee @@ -70,23 +70,25 @@ angular.module('News').factory 'ItemBl', setRead: (itemId) -> item = @_itemModel.getById(itemId) if angular.isDefined(item) - item.setRead() - @_persistence.readItem(itemId) + if not item.isRead() + item.setRead() + @_persistence.readItem(itemId) - feed = @_feedModel.getById(item.feedId) - if angular.isDefined(feed) - feed.unreadCount -= 1 + feed = @_feedModel.getById(item.feedId) + if angular.isDefined(feed) + feed.unreadCount -= 1 setUnread: (itemId) -> item = @_itemModel.getById(itemId) if angular.isDefined(item) - item.setUnread() - @_persistence.unreadItem(itemId) + if item.isRead() + item.setUnread() + @_persistence.unreadItem(itemId) - feed = @_feedModel.getById(item.feedId) - if angular.isDefined(feed) - feed.unreadCount += 1 + feed = @_feedModel.getById(item.feedId) + if angular.isDefined(feed) + feed.unreadCount += 1 getFeedTitle: (itemId) -> |