feat: add button to mark all notifications as read and fix action
This commit is contained in:
		@@ -5,9 +5,22 @@
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <div class="block">
 | 
			
		||||
        <h1 class="title is-1">{% translate 'Benachrichtigungen' %}</h1>
 | 
			
		||||
        {% with notifications=notifications_unread %}
 | 
			
		||||
            {% include "fellchensammlung/lists/list-notifications.html" %}
 | 
			
		||||
        {% endwith %}
 | 
			
		||||
        {% if notifications_unread|length > 0 %}
 | 
			
		||||
            <div class="block">
 | 
			
		||||
                <form class="button is-danger" method="POST">
 | 
			
		||||
                    {% csrf_token %}
 | 
			
		||||
                    <input type="hidden" name="action" value="notification_mark_all_read">
 | 
			
		||||
                    <button class="" type="submit" id="submit">
 | 
			
		||||
                        {% trans 'Alle Benachrichtigungen als gelesen markieren' %}
 | 
			
		||||
                    </button>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        <div class="block">
 | 
			
		||||
            {% with notifications=notifications_unread %}
 | 
			
		||||
                {% include "fellchensammlung/lists/list-notifications.html" %}
 | 
			
		||||
            {% endwith %}
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="block">
 | 
			
		||||
 
 | 
			
		||||
@@ -563,7 +563,7 @@ def process_notification_actions(request, action):
 | 
			
		||||
            return render(request, "fellchensammlung/errors/403.html", status=403)
 | 
			
		||||
        notification.mark_read()
 | 
			
		||||
    elif action == "notification_mark_all_read":
 | 
			
		||||
        notifications = Notification.objects.filter(user=request.user, mark_read=False)
 | 
			
		||||
        notifications = Notification.objects.filter(user_to_notify=request.user, read=False)
 | 
			
		||||
        for notification in notifications:
 | 
			
		||||
            notification.mark_read()
 | 
			
		||||
    return None
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user