diff --git a/boards/views/thread/gallery.py b/boards/views/thread/gallery.py --- a/boards/views/thread/gallery.py +++ b/boards/views/thread/gallery.py @@ -3,7 +3,6 @@ from boards.views.thread import ThreadVi TEMPLATE_GALLERY = 'boards/thread_gallery.html' CONTEXT_POSTS = 'posts' -CONTEXT_OP = 'opening_post' class GalleryThreadView(ThreadView): @@ -16,7 +15,6 @@ class GalleryThreadView(ThreadView): params[CONTEXT_POSTS] = thread.get_replies_with_images( view_fields_only=True) - params[CONTEXT_OP] = thread.get_opening_post() return params diff --git a/boards/views/thread/normal.py b/boards/views/thread/normal.py --- a/boards/views/thread/normal.py +++ b/boards/views/thread/normal.py @@ -1,9 +1,7 @@ -from boards import settings from boards.views.thread import ThreadView TEMPLATE_NORMAL = 'boards/thread_normal.html' -CONTEXT_OP = 'opening_post' CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress' CONTEXT_POSTS_LEFT = 'posts_left' CONTEXT_BUMPABLE = 'bumpable' @@ -29,6 +27,4 @@ class NormalThreadView(ThreadView): params[CONTEXT_BUMPLIMIT_PRG] = str( float(left_posts) / max_posts * 100) - params[CONTEXT_OP] = thread.get_opening_post() - return params diff --git a/boards/views/thread/thread.py b/boards/views/thread/thread.py --- a/boards/views/thread/thread.py +++ b/boards/views/thread/thread.py @@ -22,6 +22,7 @@ CONTEXT_WS_HOST = 'ws_host' CONTEXT_WS_PORT = 'ws_port' CONTEXT_WS_TIME = 'ws_token_time' CONTEXT_MODE = 'mode' +CONTEXT_OP = 'opening_post' FORM_TITLE = 'title' FORM_TEXT = 'text' @@ -53,6 +54,7 @@ class ThreadView(BaseBoardView, PostMixi params[CONTEXT_LASTUPDATE] = str(thread_to_show.last_edit_time) params[CONTEXT_THREAD] = thread_to_show params[CONTEXT_MODE] = self.get_mode() + params[CONTEXT_OP] = opening_post if settings.get_bool('External', 'WebsocketsEnabled'): token_time = format(timezone.now(), u'U') @@ -118,19 +120,19 @@ class ThreadView(BaseBoardView, PostMixi else: return post - def get_data(self, thread): + def get_data(self, thread) -> dict: """ Returns context params for the view. """ - pass + return dict() - def get_template(self): + def get_template(self) -> str: """ Gets template to show the thread mode on. """ pass - def get_mode(self): + def get_mode(self) -> str: pass diff --git a/boards/views/thread/tree.py b/boards/views/thread/tree.py --- a/boards/views/thread/tree.py +++ b/boards/views/thread/tree.py @@ -1,27 +1,12 @@ -from boards import settings from boards.views.thread import ThreadView TEMPLATE_TREE = 'boards/thread_tree.html' -CONTEXT_OP = 'opening_post' -CONTEXT_BUMPABLE = 'bumpable' - class TreeThreadView(ThreadView): def get_template(self): return TEMPLATE_TREE - def get_data(self, thread): - params = dict() - - bumpable = thread.can_bump() - params[CONTEXT_BUMPABLE] = bumpable - max_posts = thread.max_posts - - params[CONTEXT_OP] = thread.get_opening_post() - - return params - def get_mode(self): return 'tree'