|
|
|
@ -6,6 +6,7 @@ |
|
|
|
from collections import namedtuple |
|
|
|
from typing import Any, Optional, Union |
|
|
|
|
|
|
|
from datetime import timedelta |
|
|
|
from marshmallow import missing, ValidationError |
|
|
|
from marshmallow.fields import Boolean, String |
|
|
|
from pyramid.httpexceptions import HTTPFound |
|
|
|
@ -27,7 +28,7 @@ from tildes.enums import ( |
|
|
|
TopicSortOption, |
|
|
|
) |
|
|
|
from tildes.lib.database import ArrayOfLtree |
|
|
|
from tildes.lib.datetime import SimpleHoursPeriod |
|
|
|
from tildes.lib.datetime import SimpleHoursPeriod, utc_now |
|
|
|
from tildes.models.comment import Comment, CommentNotification, CommentTree |
|
|
|
from tildes.models.group import Group, GroupWikiPage |
|
|
|
from tildes.models.log import LogComment, LogTopic |
|
|
|
@ -374,6 +375,11 @@ def get_topic(request: Request, comment_order: CommentTreeSortOption) -> dict: |
|
|
|
tree.uncollapse_new_comments(topic.last_visit_time) |
|
|
|
tree.finalize_collapsing_maximized() |
|
|
|
|
|
|
|
old_topic_warning = False |
|
|
|
|
|
|
|
if utc_now() - topic.created_time > timedelta(days=62): |
|
|
|
old_topic_warning = True |
|
|
|
|
|
|
|
return { |
|
|
|
"topic": topic, |
|
|
|
"log": log, |
|
|
|
@ -381,6 +387,7 @@ def get_topic(request: Request, comment_order: CommentTreeSortOption) -> dict: |
|
|
|
"comment_order": comment_order, |
|
|
|
"comment_order_options": CommentTreeSortOption, |
|
|
|
"comment_label_options": CommentLabelOption, |
|
|
|
"old_topic_warning": old_topic_warning, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|