def post_save(self, instance, **kwargs): if defaults.PYBB_NOTIFICATION_ENABLE and kwargs.get('created', False): notify_topic_subscribers(instance) if defaults.PYBB_ATTACHMENT_ENABLE: from pybb.models import Attachment Attachment.objects.filter(post_hash=instance.hash, post__isnull=True).update(post=instance)
def post_saved(instance, **kwargs): notify_topic_subscribers(instance) if instance.user.get_profile().autosubscribe: instance.topic.subscribers.add(instance.user) profile = instance.user.get_profile() profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): notify_topic_subscribers(instance) if instance.user.get_profile().autosubscribe: instance.topic.subscribers.add(instance.user) profile = instance.user.get_profile() profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): notify_topic_subscribers(instance) if get_pybb_profile(instance.user).autosubscribe: instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = get_pybb_profile(instance.user) profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): if not defaults.PYBB_DISABLE_NOTIFICATIONS: notify_topic_subscribers(instance) if util.get_pybb_profile(instance.user).autosubscribe: instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = util.get_pybb_profile(instance.user) profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): if not defaults.PYBB_DISABLE_NOTIFICATIONS: notify_topic_subscribers(instance) if util.get_pybb_profile(instance.user).autosubscribe and \ perms.may_subscribe_topic(instance.user, instance.topic): instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = util.get_pybb_profile(instance.user) profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): created = kwargs.get('created') if created: notify_topic_subscribers(instance) if instance.user.get_profile().autosubscribe: instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = instance.user.get_profile() profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): if getattr(instance, '_post_saved_done', False): #Do not spam users when post is saved more than once in a same request. #For eg, when we parse attachments. return instance._post_saved_done = True if not defaults.PYBB_DISABLE_NOTIFICATIONS: notify_topic_subscribers(instance) if util.get_pybb_profile(instance.user).autosubscribe and \ perms.may_subscribe_topic(instance.user, instance.topic): instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = util.get_pybb_profile(instance.user) profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): if getattr(instance, '_post_saved_done', False): #Do not spam users when post is saved more than once in a same request. #For eg, when we parse attachments. return instance._post_saved_done = True if not defaults.PYBB_DISABLE_NOTIFICATIONS: notify_topic_subscribers(instance) if util.get_pybb_profile(instance.user).autosubscribe and \ perms.may_subscribe_topic(instance.user, instance.topic): instance.topic.subscribers.add(instance.user) if kwargs['created']: profile = util.get_pybb_profile(instance.user) profile.post_count = instance.user.posts.count() profile.save()
def post_saved(instance, **kwargs): notify_topic_subscribers(instance) profile = instance.user.pybb_profile profile.post_count = instance.user.pybb_posts.count() profile.save()
def post_saved(instance, **kwargs): notify_topic_subscribers(instance)