|
@@ -142,6 +142,10 @@ def forum_is_unread(forum, forumsread, user):
|
|
read_cutoff = datetime.utcnow() - timedelta(
|
|
read_cutoff = datetime.utcnow() - timedelta(
|
|
days=flaskbb_config["TRACKER_LENGTH"])
|
|
days=flaskbb_config["TRACKER_LENGTH"])
|
|
|
|
|
|
|
|
+
|
|
|
|
+ if read_cutoff == 0:
|
|
|
|
+ return False
|
|
|
|
+
|
|
|
|
|
|
if forum and forum.topic_count == 0:
|
|
if forum and forum.topic_count == 0:
|
|
return False
|
|
return False
|
|
@@ -156,7 +160,7 @@ def forum_is_unread(forum, forumsread, user):
|
|
|
|
|
|
|
|
|
|
def topic_is_unread(topic, topicsread, user, forumsread=None):
|
|
def topic_is_unread(topic, topicsread, user, forumsread=None):
|
|
- """Checks if a topic is unread
|
|
+ """Checks if a topic is unread.
|
|
|
|
|
|
:param topic: The topic that should be checked if it is unread
|
|
:param topic: The topic that should be checked if it is unread
|
|
|
|
|
|
@@ -176,17 +180,27 @@ def topic_is_unread(topic, topicsread, user, forumsread=None):
|
|
read_cutoff = datetime.utcnow() - timedelta(
|
|
read_cutoff = datetime.utcnow() - timedelta(
|
|
days=flaskbb_config["TRACKER_LENGTH"])
|
|
days=flaskbb_config["TRACKER_LENGTH"])
|
|
|
|
|
|
|
|
+
|
|
|
|
+ if read_cutoff == 0:
|
|
|
|
+ return False
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if topic.last_post.date_created < read_cutoff:
|
|
|
|
+ return False
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- if topic and not topicsread and topic.last_post.date_created > read_cutoff:
|
|
+ if topicsread is None:
|
|
|
|
|
|
|
|
|
|
if forumsread and forumsread.cleared is not None:
|
|
if forumsread and forumsread.cleared is not None:
|
|
return forumsread.cleared < topic.last_post.date_created
|
|
return forumsread.cleared < topic.last_post.date_created
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+
|
|
return True
|
|
return True
|
|
|
|
|
|
|
|
+
|
|
return topicsread.last_read < topic.last_post.date_created
|
|
return topicsread.last_read < topic.last_post.date_created
|
|
|
|
|
|
|
|
|