Only show delete icon on posts which can be deleted

master
Bob Mottram 2019-08-04 20:28:21 +01:00
parent cc52d917b2
commit 7c7bb45c0d
2 changed files with 10 additions and 3 deletions

View File

@ -795,6 +795,11 @@ class PubServer(BaseHTTPRequestHandler):
if authorized and '?delete=' in self.path:
deleteUrl=self.path.split('?delete=')[1]
actor=self.path.split('?delete=')[0]
if actor not in deleteUrl:
# You can only delete your own posts
self.server.GETbusy=False
self._redirect_headers(actor+'/inbox',cookie)
return
self.postToNickname=getNicknameFromActor(actor)
if not self.server.session:
self.server.session= \

View File

@ -693,9 +693,11 @@ def individualPostAsHtml(baseDir: str, \
likeStr= \
'<a href="/users/'+nickname+'?'+likeLink+'='+postJsonObject['object']['id']+'" title="'+likeTitle+'">' \
'<img src="/icons/'+likeIcon+'"/></a>'
deleteStr= \
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+'" title="Delete this post">' \
'<img src="/icons/delete.png"/></a>'
deleteStr=''
if '/users/'+nickname+'/' in postJsonObject['object']['id']:
deleteStr= \
'<a href="/users/'+nickname+'?delete='+postJsonObject['object']['id']+'" title="Delete this post">' \
'<img src="/icons/delete.png"/></a>'
if showIcons:
footerStr='<div class="'+containerClassIcons+'">'