Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tente de créer un raccourcis pour que les modo puissent supprimer les mauvais domaines #6552

Merged
merged 10 commits into from
Oct 17, 2024
17 changes: 17 additions & 0 deletions templates/member/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,23 @@ <h3>{% trans 'Sanctions' %}</h3>
{% trans "Confirmer" %}
</button>
</form>
{% if provider_to_ban %}
<!-- if the user was banned and he was the first for his mail provider, propose quick access to ban provider -->
<a href="#ban-provider-{{ provider_to_ban.pk }}" class="open-modal tail">
<p>
{% trans "Bannir le fournisseur email" %}
</p>
</a>
<form method="post" action="{% url 'check-new-email-provider' provider_to_ban.pk %}" id="ban-provider-{{ provider_to_ban.pk }}" class="modal modal-flex">
<p>
{% blocktrans with provider=provider_to_ban.provider %}
Bannir le fournisseur email <code>{{ provider }}</code>&nbsp;?
{% endblocktrans %}
</p>
{% csrf_token %}
<button type="submit" name="ban" class="btn btn-submit">{% trans "Confirmer" %}</button>
</form>
{% endif %}
{% endif %}
</div>
{% endif %}
Expand Down
6 changes: 6 additions & 0 deletions zds/member/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ def get_context_data(self, **kwargs):
context["alerts"] = profile.alerts_on_this_profile.all().order_by("-pubdate")
context["has_unsolved_alerts"] = profile.alerts_on_this_profile.filter(solved=False).exists()

if self.request.user.has_perm("user.change_bannedemailprovider"):
new_provider = NewEmailProvider.objects.filter(user=usr).first()
if new_provider is not None:
context["provider_to_ban"] = new_provider

context["summaries"] = self.get_summaries(profile, hide_forum_activity)

return context


Expand Down