Show More
@@ -51,7 +51,7 b' class PostManager(models.Manager):' | |||
|
51 | 51 | |
|
52 | 52 | post = self.create(title=title, |
|
53 | 53 | text=text, |
|
54 |
pub_time=ti |
|
|
54 | pub_time=posting_time, | |
|
55 | 55 | thread=thread, |
|
56 | 56 | image=image, |
|
57 | 57 | poster_ip=ip, |
@@ -183,7 +183,7 b' class PostManager(models.Manager):' | |||
|
183 | 183 | if ref_post.count() > 0: |
|
184 | 184 | referenced_post = ref_post[0] |
|
185 | 185 | referenced_post.referenced_posts.add(post) |
|
186 |
referenced_post.last_edit_time = |
|
|
186 | referenced_post.last_edit_time = post.pub_time | |
|
187 | 187 | referenced_post.save() |
|
188 | 188 | |
|
189 | 189 | def _get_page_count(self, thread_count): |
@@ -53,6 +53,8 b' function updateThread() {' | |||
|
53 | 53 | var diffUrl = '/api/diff_thread/' + threadId + '/' + lastUpdateTime + '/'; |
|
54 | 54 | $.getJSON(diffUrl) |
|
55 | 55 | .success(function(data) { |
|
56 | var bottom = isPageBottom(); | |
|
57 | ||
|
56 | 58 | var addedPosts = data.added; |
|
57 | 59 | |
|
58 | 60 | for (var i = 0; i < addedPosts.length; i++) { |
@@ -81,10 +83,15 b' function updateThread() {' | |||
|
81 | 83 | blink(post); |
|
82 | 84 | } |
|
83 | 85 | |
|
84 |
// TODO Process |
|
|
86 | // TODO Process deleted posts | |
|
85 | 87 | |
|
86 | 88 | lastUpdateTime = data.last_update; |
|
87 | 89 | loading = false; |
|
90 | ||
|
91 | if (bottom) { | |
|
92 | var $target = $('html,body'); | |
|
93 | $target.animate({scrollTop: $target.height()}, 1000); | |
|
94 | } | |
|
88 | 95 | }) |
|
89 | 96 | .error(function(data) { |
|
90 | 97 | // TODO Show error message that server is unavailable? |
@@ -93,6 +100,13 b' function updateThread() {' | |||
|
93 | 100 | }); |
|
94 | 101 | } |
|
95 | 102 | |
|
103 | function isPageBottom() { | |
|
104 | var scroll = $(window).scrollTop() / ($(document).height() | |
|
105 | - $(window).height()) | |
|
106 | ||
|
107 | return scroll == 1 | |
|
108 | } | |
|
109 | ||
|
96 | 110 | function initAutoupdate() { |
|
97 | 111 | loading = false; |
|
98 | 112 |
@@ -14,6 +14,7 b' from django.template import RequestConte' | |||
|
14 | 14 | from django.shortcuts import render, redirect, get_object_or_404 |
|
15 | 15 | from django.utils import timezone |
|
16 | 16 | from django.db import transaction |
|
17 | import math | |
|
17 | 18 | |
|
18 | 19 | from boards import forms |
|
19 | 20 | import boards |
@@ -420,7 +421,7 b' def api_get_threaddiff(request, thread_i' | |||
|
420 | 421 | |
|
421 | 422 | thread = get_object_or_404(Post, id=thread_id) |
|
422 | 423 | |
|
423 | filter_time = datetime.fromtimestamp(float(last_update_time) / 1000, | |
|
424 | filter_time = datetime.fromtimestamp(float(last_update_time) / 1000000, | |
|
424 | 425 | timezone.get_current_timezone()) |
|
425 | 426 | |
|
426 | 427 | json_data = { |
@@ -560,4 +561,4 b' def _remove_invalid_links(text):' | |||
|
560 | 561 | def _datetime_to_epoch(datetime): |
|
561 | 562 | return int(time.mktime(timezone.localtime( |
|
562 | 563 | datetime,timezone.get_current_timezone()).timetuple()) |
|
563 | * 1000 + datetime.microsecond) No newline at end of file | |
|
564 | * 1000000 + datetime.microsecond) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now