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
14 changes: 14 additions & 0 deletions templates/member/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,20 @@ <h3>{% trans 'Sanctions' %}</h3>
{% trans "Confirmer" %}
</button>
</form>
<!-- if the user was banned and he was the first for his mail provider, propose
quick access to ban provider -->
{% if can_ban_provider %}
<a href="#ban-provider-{{ provider.pk }}" class="open-modal tail">
{% trans "Bannir le fournisseur" %}
<form method="post" action="{% url 'check-new-email-provider' provider.pk %}" id="ban-provider-{{ provider.pk }}"
class="modal modal-flex">
<p>
{% trans "Bannir le fournisseur email " %} {{ provider.provider }} ?
philippemilink marked this conversation as resolved.
Show resolved Hide resolved
</p>
{% csrf_token %}
<button type="submit" name="ban" class="btn btn-submit">{% trans "Confirmer" %}</button>
</form>
{% endif %}
{% endif %}
</div>
{% endif %}
Expand Down
5 changes: 4 additions & 1 deletion zds/member/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ def get_context_data(self, **kwargs):
context["karmaform"] = KarmaForm(profile)
context["alerts"] = profile.alerts_on_this_profile.all().order_by("-pubdate")
context["has_unsolved_alerts"] = profile.alerts_on_this_profile.filter(solved=False).exists()

has_ban_provider_perm = self.request.user.has_perm("user.change_bannedemailprovider")
new_provider = NewEmailProvider.objects.where(user=usr).first()
context["can_ban_provider"] = has_ban_provider_perm and new_provider is not None
context["provider"] = new_provider
context["summaries"] = self.get_summaries(profile, hide_forum_activity)
return context

Expand Down
1 change: 1 addition & 0 deletions zds/utils/templatetags/interventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django import template
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from django.db.models import F

Expand Down
Loading