Skip to content

Commit

Permalink
Refactorise les URL de notifications (#6297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D authored Jul 3, 2022
1 parent 3d5e6ce commit 8da239f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ <h1>{% trans "Messagerie privée" %}</h1>

{# NOTIFICATIONS #}
<div>
<a href="{% url 'notification-list' %}" class="ico-link" title="{% trans 'Notifications' %}">
<a href="{% url "notification:list" %}" class="ico-link" title="{% trans 'Notifications' %}">
{% if header_general_notifications.total > 0 %}
<span class="notif-count">{{ header_general_notifications.total }}</span>
{% endif %}
Expand Down Expand Up @@ -290,7 +290,7 @@ <h1 class="dropdown-title">{% trans "Notifications" %}</h1>
</li>
{% endif %}
</ul>
<a href="{% url 'notification-list' %}" class="dropdown-link-all">
<a href="{% url "notification:list" %}" class="dropdown-link-all">
{% trans "Toutes les notifications" %}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/notification/followed.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3>{% trans "Actions" %}</h3>
<ul>
<li>
<a href="#mark-notifications-as-read" class="open-modal ico-after tick green">{% trans 'Tout marquer comme lu' %}</a>
<form action="{% url 'mark-notifications-as-read' %}" method="post" id="mark-notifications-as-read" class="modal modal-flex">
<form action="{% url "notification:mark-as-read" %}" method="post" id="mark-notifications-as-read" class="modal modal-flex">
{% csrf_token %}
<p>
{% trans 'Voulez-vous vraiment marquer toutes vos notifications comme lues ?' %}
Expand Down
2 changes: 1 addition & 1 deletion zds/notification/tests/tests_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def test_mark_notifications_as_read(self):

self.assertFalse(topic.is_read)

result = self.client.post(reverse("mark-notifications-as-read"), follow=False)
result = self.client.post(reverse("notification:mark-as-read"), follow=False)
self.assertEqual(result.status_code, 302)

notifications = Notification.objects.get_unread_notifications_of(self.user1)
Expand Down
8 changes: 5 additions & 3 deletions zds/notification/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from django.urls import re_path
from django.urls import path

from zds.notification.views import NotificationList, mark_notifications_as_read

app_name = "notification"

urlpatterns = [
re_path(r"^$", NotificationList.as_view(), name="notification-list"),
re_path(r"^marquer-comme-lues/$", mark_notifications_as_read, name="mark-notifications-as-read"),
path("", NotificationList.as_view(), name="list"),
path("marquer-comme-lues/", mark_notifications_as_read, name="mark-as-read"),
]
2 changes: 1 addition & 1 deletion zds/notification/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ def mark_notifications_as_read(request):

messages.success(request, _("Vos notifications ont bien été marquées comme lues."))

return redirect(reverse("notification-list"))
return redirect(reverse("notification:list"))
2 changes: 1 addition & 1 deletion zds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def location(self, item):
re_path(r"^rechercher/", include(("zds.searchv2.urls", "zds.searchv2"), namespace="search")),
path("munin/", include(("zds.munin.urls", ""))),
path("mise-en-avant/", include("zds.featured.urls")),
re_path(r"^notifications/", include(("zds.notification.urls", ""))),
path("notifications/", include("zds.notification.urls")),
path("", include(("social_django.urls", "social_django"), namespace="social")),
re_path(r"^munin/", include(("munin.urls", "munin"))),
re_path(r"^$", home_view, name="homepage"),
Expand Down

0 comments on commit 8da239f

Please sign in to comment.