Show More
@@ -152,13 +152,6 b' class Post(models.Model, Viewable):' | |||||
152 | def get_thread_id(self): |
|
152 | def get_thread_id(self): | |
153 | return self.thread_id |
|
153 | return self.thread_id | |
154 |
|
154 | |||
155 | def get_threads(self) -> QuerySet: |
|
|||
156 | """ |
|
|||
157 | Gets post's thread. |
|
|||
158 | """ |
|
|||
159 |
|
||||
160 | return self.threads |
|
|||
161 |
|
||||
162 | def _get_cache_key(self): |
|
155 | def _get_cache_key(self): | |
163 | return [datetime_to_epoch(self.last_edit_time)] |
|
156 | return [datetime_to_epoch(self.last_edit_time)] | |
164 |
|
157 |
@@ -238,14 +238,12 b' class Thread(models.Model):' | |||||
238 | def update_posts_time(self, exclude_posts=None): |
|
238 | def update_posts_time(self, exclude_posts=None): | |
239 | last_edit_time = self.last_edit_time |
|
239 | last_edit_time = self.last_edit_time | |
240 |
|
240 | |||
241 |
for post in self. |
|
241 | for post in self.replies.all(): | |
242 | if exclude_posts is None or post not in exclude_posts: |
|
242 | if exclude_posts is None or post not in exclude_posts: | |
243 | # Manual update is required because uids are generated on save |
|
243 | # Manual update is required because uids are generated on save | |
244 | post.last_edit_time = last_edit_time |
|
244 | post.last_edit_time = last_edit_time | |
245 | post.save(update_fields=['last_edit_time']) |
|
245 | post.save(update_fields=['last_edit_time']) | |
246 |
|
246 | |||
247 | post.get_threads().update(last_edit_time=last_edit_time) |
|
|||
248 |
|
||||
249 | def notify_clients(self): |
|
247 | def notify_clients(self): | |
250 | if not settings.get_bool('External', 'WebsocketsEnabled'): |
|
248 | if not settings.get_bool('External', 'WebsocketsEnabled'): | |
251 | return |
|
249 | return |
General Comments 0
You need to be logged in to leave comments.
Login now