Show More
@@ -109,8 +109,8 b' class Post(models.Model, Viewable):' | |||||
109 |
|
109 | |||
110 | def get_referenced_posts(self): |
|
110 | def get_referenced_posts(self): | |
111 | threads = self.get_threads().all() |
|
111 | threads = self.get_threads().all() | |
112 | return self.referenced_posts.filter(threads__in=threads)\ |
|
112 | return self.referenced_posts.filter(threads__in=threads) \ | |
113 |
|
|
113 | .order_by('pub_time').distinct().all() | |
114 |
|
114 | |||
115 | def get_title(self) -> str: |
|
115 | def get_title(self) -> str: | |
116 | """ |
|
116 | """ | |
@@ -271,7 +271,7 b' class Post(models.Model, Viewable):' | |||||
271 |
|
271 | |||
272 | try: |
|
272 | try: | |
273 | global_id = GlobalId.objects.get(key_type=key_type, |
|
273 | global_id = GlobalId.objects.get(key_type=key_type, | |
274 | key=key, local_id=local_id) |
|
274 | key=key, local_id=local_id) | |
275 | for post in Post.objects.filter(global_id=global_id).only('id'): |
|
275 | for post in Post.objects.filter(global_id=global_id).only('id'): | |
276 | global_replied.append(post.id) |
|
276 | global_replied.append(post.id) | |
277 | except GlobalId.DoesNotExist: |
|
277 | except GlobalId.DoesNotExist: |
@@ -35,15 +35,13 b' class PostManager(models.Manager):' | |||||
35 | opening_posts = [] |
|
35 | opening_posts = [] | |
36 |
|
36 | |||
37 | posting_time = timezone.now() |
|
37 | posting_time = timezone.now() | |
|
38 | new_thread = False | |||
38 | if not thread: |
|
39 | if not thread: | |
39 | thread = boards.models.thread.Thread.objects.create( |
|
40 | thread = boards.models.thread.Thread.objects.create( | |
40 | bump_time=posting_time, last_edit_time=posting_time) |
|
41 | bump_time=posting_time, last_edit_time=posting_time) | |
41 | list(map(thread.tags.add, tags)) |
|
42 | list(map(thread.tags.add, tags)) | |
42 | boards.models.thread.Thread.objects.process_oldest_threads() |
|
43 | boards.models.thread.Thread.objects.process_oldest_threads() | |
43 | else: |
|
44 | new_thread = True | |
44 | thread.last_edit_time = posting_time |
|
|||
45 | thread.bump() |
|
|||
46 | thread.save() |
|
|||
47 |
|
45 | |||
48 | pre_text = Parser().preparse(text) |
|
46 | pre_text = Parser().preparse(text) | |
49 |
|
47 | |||
@@ -64,6 +62,11 b' class PostManager(models.Manager):' | |||||
64 | if image: |
|
62 | if image: | |
65 | post.images.add(PostImage.objects.create_with_hash(image)) |
|
63 | post.images.add(PostImage.objects.create_with_hash(image)) | |
66 |
|
64 | |||
|
65 | if not new_thread: | |||
|
66 | thread.last_edit_time = posting_time | |||
|
67 | thread.bump() | |||
|
68 | thread.save() | |||
|
69 | ||||
67 | post.build_url() |
|
70 | post.build_url() | |
68 | post.connect_replies() |
|
71 | post.connect_replies() | |
69 | post.connect_threads(opening_posts) |
|
72 | post.connect_threads(opening_posts) |
General Comments 0
You need to be logged in to leave comments.
Login now