From 1e395150ba79c352877114b5cb16c1f3f95f0fc4 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 25 Apr 2015 11:43:12 -0700 Subject: [PATCH] Don't show filtered posts in thread watcher unread count. --- src/Filtering/Filter.coffee | 6 ++++++ src/Monitoring/ThreadWatcher.coffee | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index a2eeef431..48c18b01a 100755 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -121,6 +121,12 @@ Filter = if !@isReply and result.top @thread.isOnTop = true + isHidden: (post) -> + for key of Filter.filters when (value = Filter[key] post)? + for filter in Filter.filters[key] when result = filter value, post.isReply + return true if result.hide + false + name: (post) -> post.info.name uniqueID: (post) -> post.info.uniqueID tripcode: (post) -> post.info.tripcode diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 6e6ecc648..73f8a367e 100755 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -214,6 +214,8 @@ ThreadWatcher = for postObj in @response.posts continue unless postObj.no > lastReadPost continue if QR.db?.get {boardID, threadID, postID: postObj.no} + continue if Filter.isHidden(Build.parseJSON postObj, boardID) + unread++ continue unless QR.db and postObj.com regexp = /]*\bhref="(?:\/([^\/]+)\/thread\/(\d+))?(?:#p(\d+))?"/g