Fix moderation report sending

master
Bob Mottram 2019-08-11 19:32:29 +01:00
parent c498e79b14
commit 33cbe80c20
3 changed files with 20 additions and 7 deletions

View File

@ -36,7 +36,7 @@ def getOcapFilename(baseDir :str,nickname: str,domain: str,actor :str,subdir: st
ocDir=baseDir+'/accounts/'+nickname+'@'+domain+'/ocap/'+subdir ocDir=baseDir+'/accounts/'+nickname+'@'+domain+'/ocap/'+subdir
if not os.path.isdir(ocDir): if not os.path.isdir(ocDir):
os.mkdir(ocDir) os.mkdir(ocDir)
return baseDir+'/accounts/'+nickname+'@'+domain+'/ocap/'+subdir+'/'+actor.replace('/','#')+'.json' return baseDir+'/accounts/'+nickname+'@'+domain+'/ocap/'+subdir+'/'+actor.replace('/','#')+'.json'
def CapablePost(postJson: {}, capabilityList: [], debug :bool) -> bool: def CapablePost(postJson: {}, capabilityList: [], debug :bool) -> bool:

View File

@ -2183,6 +2183,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
postState=self._receiveNewPost(authorized,'newfollowers') postState=self._receiveNewPost(authorized,'newfollowers')
if postState!=0: if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie) self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2190,6 +2191,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
postState=self._receiveNewPost(authorized,'newdm') postState=self._receiveNewPost(authorized,'newdm')
if postState!=0: if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie) self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2197,6 +2199,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
postState=self._receiveNewPost(authorized,'newreport') postState=self._receiveNewPost(authorized,'newreport')
if postState!=0: if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie) self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2204,6 +2207,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
postState=self._receiveNewPost(authorized,'newshare') postState=self._receiveNewPost(authorized,'newshare')
if postState!=0: if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/shares',cookie) self._redirect_headers('/users/'+self.postToNickname+'/shares',cookie)

View File

@ -428,6 +428,11 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
summary=subject summary=subject
sensitive=True sensitive=True
if toUrl:
if not isinstance(toUrl, str):
print('ERROR: toUrl is not a string')
return None
# who to send to # who to send to
toRecipients=[toUrl] + mentionedRecipients toRecipients=[toUrl] + mentionedRecipients
@ -810,12 +815,16 @@ def createReportPost(baseDir: str,
print(str(moderatorsList)) print(str(moderatorsList))
postTo=moderatorsList postTo=moderatorsList
postCc=None postCc=None
return createPostBase(baseDir,nickname, domain, port, \ postJsonObject=None
postTo,postCc, \ for toUrl in postTo:
httpPrefix, content, followersOnly, saveToFile, \ postJsonObject= \
clientToServer, \ createPostBase(baseDir,nickname, domain, port, \
attachImageFilename,imageDescription,useBlurhash, \ toUrl,postCc, \
None, None, subject) httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \
None, None, subject)
return postJsonObject
def threadSendPost(session,postJsonObject: {},federationList: [],\ def threadSendPost(session,postJsonObject: {},federationList: [],\
inboxUrl: str, baseDir: str,signatureHeaderJson: {},postLog: [], inboxUrl: str, baseDir: str,signatureHeaderJson: {},postLog: [],