Skip to content

Commit

Permalink
Merge pull request #2182 from Eskimon/hotfix-2071
Browse files Browse the repository at this point in the history
Revert "Fix #1939 : Possibilité de pouvoir annuler une demande de validation
  • Loading branch information
SpaceFox committed Jan 30, 2015
2 parents 67e1eef + 3bf83e9 commit 2b43cf4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 145 deletions.
24 changes: 2 additions & 22 deletions templates/article/includes/sidebar_actions.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,9 @@ <h3>{% trans "Gestion" %}</h3>
<li class="inactive">
<span class="ico-after tick disabled">{% trans "En attente de validation" %}</span>
</li>
<li>
<a href="#ask-unvalidation" class="open-modal ico-after cross red">
{% trans "Retirer de la validation" %}
</a>
</li>
{% endif %}
<form action="{% url "zds.article.views.modify" %}" method="post" class="modal modal-medium" id="ask-validation">
<textarea name="comment" rows="3" placeholder="{% trans "Vos commentaires de validation" %}"></textarea>
<textarea name="comment" rows="3" placeholder="Vos commentaires de validation"></textarea>

<input type="hidden" name="article" value="{{ article.pk }}">
<input type="hidden" name="version" value="{{ version }}">
Expand All @@ -98,21 +93,6 @@ <h3>{% trans "Gestion" %}</h3>
{% trans "Confirmer" %}
</button>
</form>
<form action="{% url "zds.article.views.modify" %}" method="post" class="modal modal-big" id="ask-unvalidation">
{% if not validation.is_pending %}
{% blocktrans with validator=validation.validator %}
<p>Vous allez retirer ce tutoriel de la validation cependant un validateur ({{ validator }}) l'a déjà réservé.</p>
{% endblocktrans %}
{% endif %}
<textarea name="comment" rows="3" placeholder="{% trans "Vos commentaires" %}"></textarea>

<input type="hidden" name="article" value="{{ article.pk }}">
<input type="hidden" name="version" value="{{ version }}">
{% csrf_token %}
<button type="submit" name="unvalidate">
{% trans "Confirmer" %}
</button>
</form>
</ul>
</div>
{% endif %}
Expand Down Expand Up @@ -284,4 +264,4 @@ <h3>{% trans "Télécharger" %}</h3>
</a>
</li>
</ul>
</div>
</div>
20 changes: 0 additions & 20 deletions templates/tutorial/tutorial/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,30 +335,10 @@ <h2>
<li class="inactive">
<span class="ico-after tick disabled">{% trans "En attente de validation" %}</span>
</li>
<li>
<a href="#ask-unvalidation" class="open-modal ico-after cross red">
{% trans "Retirer de la validation" %}
</a>
</li>
{% endif %}
<div id="ask-validation" class="modal modal-big">
{% crispy formAskValidation %}
</div>
<form action="{% url "zds.tutorial.views.modify_tutorial" %}" method="post" class="modal modal-big" id="ask-unvalidation">
{% if not validation.is_pending %}
{% blocktrans with validator=validation.validator %}
<p>Vous allez retirer ce tutoriel de la validation cependant un validateur ({{ validator }}) l'a déjà réservé.</p>
{% endblocktrans %}
{% endif %}
<textarea name="comment" rows="3" placeholder="{% trans "Vos commentaires" %}"></textarea>

<input type="hidden" name="tutorial" value="{{ tutorial.pk }}">
<input type="hidden" name="version" value="{{ version }}">
{% csrf_token %}
<button type="submit" name="unvalidate">
{% trans "Confirmer" %}
</button>
</form>
{% endif %}
{% endblock %}

Expand Down
54 changes: 0 additions & 54 deletions zds/article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,60 +806,6 @@ def modify(request):

return redirect(redirect_url)

# user want to remove his article from the validation
elif 'unvalidate' in request.POST:

redirect_url = reverse('zds.article.views.view', args=[
article.pk,
article.slug
])

author = request.user

validation = Validation.objects.filter(article__pk=article_pk).first()
validator = validation.validator

# remove sha_validation
article.sha_validation = None
article.pubdate = None
article.save()

# check if a validator have already reserv it
if validator:

# check if the user add a comment
if request.POST['comment']:
comment = request.POST['comment']
else:
comment = u'Pas de raison évoquée.'

# send a private message to the validator
msg = (
u'Bonjour **{0}**,\n\n'
u'L\'article **{1}** que tu avais réservé vient d\'être retiré de la validation par **{2}**. Les r'
u'aisons évoqués sont les suivantes :\n\n'
u'> {3}'.format(
validator,
article.title,
author.username,
comment)
)
bot = get_object_or_404(User, username=settings.ZDS_APP['member']['bot_account'])
send_mp(
bot,
[validator],
u'Suppression de la validation de l\'article « {0} »'.format(article.title),
'',
msg,
True,
direct=False,
)

# delete the validation object
validation.delete()

return redirect(redirect_url)

return redirect(article.get_absolute_url())


Expand Down
49 changes: 0 additions & 49 deletions zds/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,55 +784,6 @@ def modify_tutorial(request):

return redirect(tutorial.get_absolute_url())

# user want to remove his article from the validation
elif 'unvalidate' in request.POST:

author = request.user

validation = Validation.objects.filter(tutorial__pk=tutorial_pk).first()
validator = validation.validator

# remove sha_validation
tutorial.sha_validation = None
tutorial.pubdate = None
tutorial.save()

# check if a validator have already reserv it
if validator:

# check if the user add a comment
if request.POST['comment']:
comment = request.POST['comment']
else:
comment = u'Pas de raison évoquée.'

# send a private message to the validator
msg = (
u'Bonjour **{0}**,\n\n'
u'Le tutoriel **{1}** que tu avais réservé vient d\'être retiré de la validation par **{2}**. Les '
u'raisons évoqués sont les suivantes :\n\n'
u'> {3}'.format(
validator,
tutorial.title,
author.username,
comment)
)
bot = get_object_or_404(User, username=settings.ZDS_APP['member']['bot_account'])
send_mp(
bot,
[validator],
u'Suppression de la validation du tutoriel « {0} »'.format(tutorial.title),
'',
msg,
True,
direct=False,
)

# delete the validation object
validation.delete()

return redirect(tutorial.get_absolute_url())

# No action performed, raise 403

raise PermissionDenied
Expand Down

0 comments on commit 2b43cf4

Please sign in to comment.