# HG changeset patch # User neko259 # Date 2015-01-04 19:31:04 # Node ID 2aafa436e707646edb663444ef7a02ec3f8cf718 # Parent 05c77e2a82b782b0ea4baf1089bb780817c18c0d Fixed sending posts to websockets. Cleaned up new post view code diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -422,7 +422,7 @@ class Post(models.Model, Viewable): # If post is in this thread, its thread was already notified. # Otherwise, notify its thread separately. - if ref_post.thread_id != thread_id: + if ref_post.thread_new_id != thread_id: ref_post.send_to_websocket(request, recursive=False) def save(self, force_insert=False, force_update=False, using=None, diff --git a/boards/views/thread.py b/boards/views/thread.py --- a/boards/views/thread.py +++ b/boards/views/thread.py @@ -122,20 +122,14 @@ class ThreadView(BaseBoardView, PostMixi title = data[FORM_TITLE] text = data[FORM_TEXT] + image = data.get(FORM_IMAGE) text = self._remove_invalid_links(text) - if FORM_IMAGE in list(data.keys()): - image = data[FORM_IMAGE] - else: - image = None - - tags = [] - post_thread = opening_post.get_thread() post = Post.objects.create_post(title=title, text=text, image=image, - thread=post_thread, ip=ip, tags=tags) + thread=post_thread, ip=ip) post.send_to_websocket(request) thread_to_show = (opening_post.id if opening_post else post.id)