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

View File

@ -2183,6 +2183,7 @@ class PubServer(BaseHTTPRequestHandler):
return
postState=self._receiveNewPost(authorized,'newfollowers')
if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname:
nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2190,6 +2191,7 @@ class PubServer(BaseHTTPRequestHandler):
return
postState=self._receiveNewPost(authorized,'newdm')
if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname:
nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2197,6 +2199,7 @@ class PubServer(BaseHTTPRequestHandler):
return
postState=self._receiveNewPost(authorized,'newreport')
if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname:
nickname=nickname.split('/')[0]
self._redirect_headers('/users/'+self.postToNickname+'/outbox',cookie)
@ -2204,6 +2207,7 @@ class PubServer(BaseHTTPRequestHandler):
return
postState=self._receiveNewPost(authorized,'newshare')
if postState!=0:
nickname=self.path.split('/users/')[1]
if '/' in nickname:
nickname=nickname.split('/')[0]
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
sensitive=True
if toUrl:
if not isinstance(toUrl, str):
print('ERROR: toUrl is not a string')
return None
# who to send to
toRecipients=[toUrl] + mentionedRecipients
@ -810,12 +815,16 @@ def createReportPost(baseDir: str,
print(str(moderatorsList))
postTo=moderatorsList
postCc=None
return createPostBase(baseDir,nickname, domain, port, \
postTo,postCc, \
httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \
None, None, subject)
postJsonObject=None
for toUrl in postTo:
postJsonObject= \
createPostBase(baseDir,nickname, domain, port, \
toUrl,postCc, \
httpPrefix, content, followersOnly, saveToFile, \
clientToServer, \
attachImageFilename,imageDescription,useBlurhash, \
None, None, subject)
return postJsonObject
def threadSendPost(session,postJsonObject: {},federationList: [],\
inboxUrl: str, baseDir: str,signatureHeaderJson: {},postLog: [],