From 1254dc1052d00dac038eb07c99f982aea02594c4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 12 Aug 2019 15:48:19 +0100 Subject: [PATCH] Replies to moderation posts are direct messages --- daemon.py | 12 ++++++++++++ webinterface.py | 24 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/daemon.py b/daemon.py index 327d2c12..0be1c1f4 100644 --- a/daemon.py +++ b/daemon.py @@ -926,6 +926,7 @@ class PubServer(BaseHTTPRequestHandler): # reply from the web interface icon inReplyToUrl=None + replyWithDM=False replyToList=[] if authorized and '?replyto=' in self.path: inReplyToUrl=self.path.split('?replyto=')[1] @@ -937,6 +938,17 @@ class PubServer(BaseHTTPRequestHandler): inReplyToUrl=mentionsList[0] self.path=self.path.split('?replyto=')[0]+'/newpost' + # replying as a direct message, for moderation posts + if authorized and '?replydm=' in self.path: + inReplyToUrl=self.path.split('?replydm=')[1] + if '?' in inReplyToUrl: + mentionsList=inReplyToUrl.split('?') + for m in mentionsList: + if m.startswith('mention='): + replyToList.append(m.replace('mention=','')) + inReplyToUrl=mentionsList[0] + self.path=self.path.split('?replydm=')[0]+'/newdm' + # edit profile in web interface if '/users/' in self.path and self.path.endswith('/editprofile'): self._set_headers('text/html',cookie) diff --git a/webinterface.py b/webinterface.py index 6d04cc7a..51c2803d 100644 --- a/webinterface.py +++ b/webinterface.py @@ -941,7 +941,10 @@ def individualPostAsHtml(baseDir: str, \ break footerStr='
' - footerStr+='' + if not isModerationPost: + footerStr+='' + else: + footerStr+='' footerStr+='' footerStr+=announceStr+likeStr+deleteStr footerStr+=''+publishedStr+'' @@ -1014,6 +1017,8 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \ moderationButtonStr='' tlStr=htmlHeader(profileStyle) + + # banner and row of buttons tlStr+= \ '' \ '' + + # second row of buttons for moderator actions + if moderator and boxName=='moderation': + tlStr+= \ + '
\n'+ \ + ' ' \ + ' ' \ + ' ' \ + '
' + + # add the javascript for content warnings tlStr+='' + + # page up arrow if pageNumber>1: tlStr+='
Page up
' + + # show the posts itemCtr=0 for item in timelineJson['orderedItems']: if item['type']=='Create' or item['type']=='Announce': @@ -1036,6 +1056,8 @@ def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \ tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \ nickname,domain,port,item,None,True, \ allowDeletion,showIndividualPostIcons) + + # page down arrow if itemCtr>=itemsPerPage: tlStr+='
Page down
' tlStr+=htmlFooter()