Skip to content

Commit

Permalink
no deletion of notificationlogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 8, 2015
1 parent e7108b1 commit fb00e84
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 31 deletions.
7 changes: 0 additions & 7 deletions ipynbsrv/web/templates/web/notifications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ <h1>Notifications</h1>
<i class="glyphicon glyphicon glyphicon-ok" aria-hidden="true"></i>
</button>
</form>
<form action="{% url 'notification_delete' %}" method="POST" role="form" class="form-action">
{% csrf_token %}
<input type="hidden" name="id" value="{{ n.id }}">
<button class="btn btn-sm btn-danger" title="Delete notification?" data-toggle="confirmation" data-placement="left">
<i class="glyphicon glyphicon glyphicon-trash" aria-hidden="true"></i>
</button>
</form>
</td>
</tr>
{% endfor %}
Expand Down
1 change: 0 additions & 1 deletion ipynbsrv/web/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
# /notification(s)/...
url(r'^notifications/$', 'ipynbsrv.web.views.notifications.index', name='notifications'),
url(r'^notifications/create$', 'ipynbsrv.web.views.notifications.create', name='notification_create'),
url(r'^notifications/delete$', 'ipynbsrv.web.views.notifications.delete', name='notification_delete'),
url(r'^notifications/mark_as_read$', 'ipynbsrv.web.views.notifications.mark_as_read', name='notification_mark_as_read'),

# internal
Expand Down
23 changes: 0 additions & 23 deletions ipynbsrv/web/views/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,6 @@ def create(request):
return redirect('notifications')


@user_passes_test(login_allowed)
def delete(request):
if request.method != "POST":
messages.error(request, "Invalid request method.")
return redirect('notifications')
# Todo: validate POST params: receiver_group, msg, type, rel objs
if 'id' not in request.POST:
messages.error(request, "Invalid POST request.")
return redirect('notifications')

client = get_httpclient_instance(request)

n_id = request.POST.get('id')

try:
client.notificationlogs(n_id).delete()
messages.success(request, "Notification sucessfully deleted.")
except Exception as e:
messages.error(request, api_error_message(e, ""))

return redirect('notifications')


@user_passes_test(login_allowed)
def mark_as_read(request):
if request.method != "POST":
Expand Down

0 comments on commit fb00e84

Please sign in to comment.