mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 06:20:16 +02:00
Merge pull request #286 from orbitroom/master
Added Ability to Remove Notifications
This commit is contained in:
commit
ca3e16c342
@ -189,4 +189,5 @@ urlpatterns = patterns('',
|
|||||||
# Notifications
|
# Notifications
|
||||||
url(r'^notifications/$', 'notifications.views.notification_list', name='auth_notification_list'),
|
url(r'^notifications/$', 'notifications.views.notification_list', name='auth_notification_list'),
|
||||||
url(r'^notifications/(\w+)/$', 'notifications.views.notification_view', name='auth_notification_view'),
|
url(r'^notifications/(\w+)/$', 'notifications.views.notification_view', name='auth_notification_view'),
|
||||||
|
url(r'^remove_notifications/(\w+)', 'notifications.views.remove_notification', name='auth_remove_notification'),
|
||||||
)
|
)
|
||||||
|
@ -29,3 +29,14 @@ def notification_view(request, notif_id):
|
|||||||
else:
|
else:
|
||||||
logger.warn("User %s not authorized to view notif_id %s belonging to user %s" % (request.user, notif_id, notif.user))
|
logger.warn("User %s not authorized to view notif_id %s belonging to user %s" % (request.user, notif_id, notif.user))
|
||||||
return redirect('auth_notification_list')
|
return redirect('auth_notification_list')
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def remove_notification(request, notif_id):
|
||||||
|
logger.debug("remove notification called by user %s for notif_id %s" % (request.user, notif_id))
|
||||||
|
if Notification.objects.filter(id=notif_id).exists():
|
||||||
|
notif = get_object_or_404(Notification, pk=notif_id)
|
||||||
|
notif.delete()
|
||||||
|
logger.info("Deleting notif id %s by user %s" % (notif_id, request.user))
|
||||||
|
else:
|
||||||
|
logger.error("Unable to delete notif id %s for user %s - notif matching id not found." % (notif_id, request.user))
|
||||||
|
return redirect('auth_notification_list')
|
@ -33,6 +33,11 @@
|
|||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="{% url 'auth_remove_notification' notif.id %}">
|
||||||
|
<button type="button" class="btn btn-danger" title="remove">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -59,6 +64,11 @@
|
|||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="{% url 'auth_remove_notification' notif.id %}">
|
||||||
|
<button type="button" class="btn btn-danger" title="remove">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user