diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -47,15 +47,17 @@ class PostManager(models.Manager): def create_post(self, title, text, image=None, thread=None, ip=NO_IP, tags=None, user=None): + posting_time = timezone.now() + post = self.create(title=title, text=text, - pub_time=timezone.now(), + pub_time=posting_time, thread=thread, image=image, poster_ip=ip, poster_user_agent=UNKNOWN_UA, - last_edit_time=timezone.now(), - bump_time=timezone.now(), + last_edit_time=posting_time, + bump_time=posting_time, user=user) if tags: @@ -66,7 +68,7 @@ class PostManager(models.Manager): if thread: thread.replies.add(post) thread.bump() - thread.last_edit_time = timezone.now() + thread.last_edit_time = posting_time thread.save() #cache_key = thread.get_cache_key() @@ -179,7 +181,10 @@ class PostManager(models.Manager): id = reply_number.group(1) ref_post = self.filter(id=id) if ref_post.count() > 0: - ref_post[0].referenced_posts.add(post) + referenced_post = ref_post[0] + referenced_post.referenced_posts.add(post) + referenced_post.last_edit_time = post.pub_time + referenced_post.save() def _get_page_count(self, thread_count): return int(math.ceil(thread_count / float(settings.THREADS_PER_PAGE))) @@ -312,7 +317,7 @@ class Post(models.Model): def can_bump(self): """Check if the thread can be bumped by replying""" - post_count = self.get_reply_count() + 1 + post_count = self.get_reply_count() return post_count <= settings.MAX_POSTS_PER_THREAD diff --git a/boards/static/js/refpopup.js b/boards/static/js/refpopup.js --- a/boards/static/js/refpopup.js +++ b/boards/static/js/refpopup.js @@ -28,7 +28,7 @@ function showPostPreview(e) { var pNum = $(this).text().match(/\d+/); if (pNum.length == 0) { - return; + return; } //position @@ -57,7 +57,7 @@ function showPostPreview(e) { }; - cln.innerHTML = gettext('Loading...'); + cln.innerHTML = "