Skip to content

Commit

Permalink
Fixed deletion of content and links
Browse files Browse the repository at this point in the history
Sometimes this can give power to users to delete entire conversations, so maybe LINK removal is something that should not be possible. People should however be able to hide their content through some other method.
  • Loading branch information
lukebarnard1 committed May 21, 2015
1 parent a245bbe commit 362d124
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/o2m/basic_client/templates/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3>{{friend.name}}</h3>
<form action="/o2m/delete_link" method="POST">
{% csrf_token %}
<input type="hidden" name="content_id" value="{{link.content}}"/>
<input type="hidden" name="friend_id" value="{{link.friend.id}}"/>
<input type="hidden" name="friend_id" value="{{link.link_friend.id}}"/>
<a href="javascript:;" onclick="submit()" title="Delete link">
<span class="glyphicon glyphicon-remove"></span>
</a>
Expand Down
3 changes: 2 additions & 1 deletion server/o2m/basic_client/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def assign_links_address(links):
for link in links:
link['address'] = friend.address
link['port'] = friend.port
link['link_friend'] = friend
if len(link['children']):
assign_links_address(link['children'])
return links
Expand Down Expand Up @@ -255,7 +256,7 @@ def add_content(request):
def delete_content(request):
"""Deletes content from the server belonging to 'me'
"""
me = Friend.objects.get(name=o2m.settings.ME)
me = Friend.objects.get(name=request.user.username)
content_id = request.POST['content_id']

resp = get_from_friend('/content/{0}'.format(content_id), me, me, method = 'DELETE')
Expand Down

0 comments on commit 362d124

Please sign in to comment.