Skip to content

Commit

Permalink
cleanup comments
Browse files Browse the repository at this point in the history
  • Loading branch information
artragis committed Apr 26, 2017
1 parent 2e9b2c4 commit 92a5255
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions zds/notification/receivers.py
Expand Up @@ -371,6 +371,7 @@ def delete_notifications(sender, instance, **kwargs):


@receiver(zds.tutorialv2.signals.content_unpublished, sender=PublishableContent)
@receiver(zds.tutorialv2.signals.content_unpublished, sender=ContentReaction)
def cleanup_notification_for_unpublished_content(sender, instance, **_):
"""
Avoid persistant notification if a content is unpublished. A real talk has to be lead to avoid such cross module \
Expand Down
11 changes: 10 additions & 1 deletion zds/tutorialv2/publication_utils.py
Expand Up @@ -15,6 +15,7 @@
from os.path import isdir, dirname
from zds import settings
from zds.settings import ZDS_APP
from zds.tutorialv2.models.models_database import ContentReaction
from zds.tutorialv2.signals import content_unpublished
from zds.tutorialv2.utils import retrieve_and_update_images_links
from zds.utils.templatetags.emarkdown import emarkdown
Expand Down Expand Up @@ -435,13 +436,21 @@ def unpublish_content(db_object):

if os.path.exists(old_path):
shutil.rmtree(old_path)

map(lambda reaction: content_unpublished.send(sender=reaction.__class__, instance=reaction),
[ContentReaction.objects.filter(related_content=db_object).all()])
# remove public_version:
public_version.delete()

db_object.public_version = None

if db_object.is_opinion:
db_object.sha_public = None
db_object.sha_picked = None
db_object.pubdate = None
db_object.save()
db_object.save()
content_unpublished.send(sender=db_object.__class__, instance=db_object)

return True

except (ObjectDoesNotExist, IOError):
Expand Down
10 changes: 0 additions & 10 deletions zds/tutorialv2/views/views_validations.py
Expand Up @@ -624,11 +624,6 @@ def form_valid(self, form):

unpublish_content(self.object)

self.object.sha_public = None
self.object.sha_picked = None
self.object.pubdate = None
self.object.save()

# send PM
msg = render_to_string(
'tutorialv2/messages/validation_revoke.md',
Expand Down Expand Up @@ -697,11 +692,6 @@ def form_valid(self, form):
if form.cleaned_data['operation'] == 'REMOVE_PUB':
unpublish_content(self.object)

self.object.sha_public = None
self.object.sha_picked = None
self.object.pubdate = None
self.object.save()

# send PM
msg = render_to_string(
'tutorialv2/messages/validation_unpublish_opinion.md',
Expand Down

0 comments on commit 92a5255

Please sign in to comment.