diff --git a/blog.py b/blog.py index a77939d3..deffb29d 100644 --- a/blog.py +++ b/blog.py @@ -26,6 +26,8 @@ from webinterface import htmlFooter from webinterface import addEmbeddedElements from utils import getNicknameFromActor from utils import getDomainFromActor +from utils import locatePost +from utils import loadJson from posts import createBlogsTimeline @@ -534,9 +536,18 @@ def htmlEditBlog(mediaInstance: bool,translate: {}, \ baseDir: str,httpPrefix: str, \ path: str, \ pageNumber: int, \ - nickname: str,domain: str) -> str: + nickname: str,domain: str, \ + postUrl: str) -> str: """Edit a blog post after it was created """ + postFilename=locatePost(baseDir,nickname,domain,postUrl) + if not postFilename: + return None + + postJsonObject=loadJson(postFilename) + if not postJsonObject: + return None + iconsDir=getIconsDir(baseDir) editBlogText='

'+translate['Write your post text below.']+'

' @@ -597,7 +608,7 @@ def htmlEditBlog(mediaInstance: bool,translate: {}, \ editBlogForm+= \ '
' + pathBase+'?'+endpoint+'?page='+str(pageNumber)+'">' editBlogForm+='
' editBlogForm+=' ' editBlogForm+='
' @@ -627,14 +638,20 @@ def htmlEditBlog(mediaInstance: bool,translate: {}, \ editBlogForm+=editBlogImageSection editBlogForm+= \ '
' - editBlogForm+=' ' + titleStr='' + if postJsonObject['object'].get('summary'): + titleStr=postJsonObject['object']['summary'] + editBlogForm+= \ + ' ' editBlogForm+='' editBlogForm+='
' messageBoxHeight=800 + contentStr=postJsonObject['object']['content'] + editBlogForm+= \ ' ' + str(messageBoxHeight)+'px">'+contentStr+'' editBlogForm+=dateAndLocation if not mediaInstance: editBlogForm+=editBlogImageSection diff --git a/daemon.py b/daemon.py index 6beb8368..8f17c604 100644 --- a/daemon.py +++ b/daemon.py @@ -2380,20 +2380,25 @@ class PubServer(BaseHTTPRequestHandler): actor=self.path.split('?actor=')[1] if '?' in actor: actor=actor.split('?')[0] + actor=self.server.domainFull+'/users/'+actor pathWithoutOptions=self.path.split('?')[0] if actor in pathWithoutOptions: nickname=getNicknameFromActor(self.path) + postUrl=pathWithoutOptions+'/statuses/'+messageId msg=htmlEditBlog(self.server.mediaInstance, \ self.server.translate, \ self.server.baseDir, \ self.server.httpPrefix, \ self.path, \ replyPageNumber, \ - nickname,self.server.domain).encode() - self._set_headers('text/html',len(msg),cookie) - self._write(msg) - self.server.GETbusy=False - return + nickname,self.server.domain, \ + postUrl) + if msg: + msg-msg.encode() + self._set_headers('text/html',len(msg),cookie) + self._write(msg) + self.server.GETbusy=False + return # edit profile in web interface if '/users/' in self.path and self.path.endswith('/editprofile'): diff --git a/webinterface.py b/webinterface.py index 1a244346..6b97ce98 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2992,15 +2992,16 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \ editStr='' if fullDomain+'/users/'+nickname in postJsonObject['actor']: if isBlogPost(postJsonObject): - editStr+= \ - ''+ \ - ''+ \
-                translate['Edit blog post']+ \
-                ' |' + if '/statuses/' in postJsonObject['object']['id']: + editStr+= \ + ''+ \ + ''+ \
+                    translate['Edit blog post']+ \
+                    ' |' announceStr='' if not isModerationPost and showRepeatIcon: