##// END OF EJS Templates
Fixed notifications for multi-thread posts. Fixed hiding hidden tag threads when viewing tag page
neko259 -
r1062:5357cb86 default
parent child Browse files
Show More
@@ -380,18 +380,20 b' class Post(models.Model, Viewable):'
380 380
381 381 client = Client()
382 382
383 thread = self.get_thread()
384 thread_id = thread.id
385 channel_name = WS_CHANNEL_THREAD + str(thread.get_opening_post_id())
386 client.publish(channel_name, {
387 WS_NOTIFICATION_TYPE: WS_NOTIFICATION_TYPE_NEW_POST,
388 })
389 client.send()
390
391 383 logger = logging.getLogger('boards.post.websocket')
392 384
393 logger.info('Sent notification from post #{} to channel {}'.format(
394 self.id, channel_name))
385 thread_ids = list()
386 for thread in self.get_threads().all():
387 thread_ids.append(thread.id)
388
389 channel_name = WS_CHANNEL_THREAD + str(thread.get_opening_post_id())
390 client.publish(channel_name, {
391 WS_NOTIFICATION_TYPE: WS_NOTIFICATION_TYPE_NEW_POST,
392 })
393 client.send()
394
395 logger.info('Sent notification from post #{} to channel {}'.format(
396 self.id, channel_name))
395 397
396 398 if recursive:
397 399 for reply_number in re.finditer(REGEX_REPLY, self.get_raw_text()):
@@ -400,9 +402,9 b' class Post(models.Model, Viewable):'
400 402 try:
401 403 ref_post = Post.objects.get(id=post_id)
402 404
403 # If post is in this thread, its thread was already notified.
404 # Otherwise, notify its thread separately.
405 if ref_post.get_thread().id != thread_id:
405 if ref_post.get_threads().exclude(id__in=thread_ids).exists():
406 # If post is in this thread, its thread was already notified.
407 # Otherwise, notify its thread separately.
406 408 ref_post.send_to_websocket(request, recursive=False)
407 409 except ObjectDoesNotExist:
408 410 pass
@@ -22,7 +22,8 b' class TagView(AllThreadsView, Dispatcher'
22 22 def get_threads(self):
23 23 tag = get_object_or_404(Tag, name=self.tag_name)
24 24
25 return tag.get_threads()
25 return tag.get_threads().exclude(
26 tags__in=self.settings_manager.get_hidden_tags())
26 27
27 28 def get_context_data(self, **kwargs):
28 29 params = super(TagView, self).get_context_data(**kwargs)
General Comments 0
You need to be logged in to leave comments. Login now