forked from indymedia/epicyon
Remove cc if not specified
parent
79baa0ddf6
commit
503db492e5
10
posts.py
10
posts.py
|
@ -246,7 +246,7 @@ def getStatusNumber() -> (str,str):
|
||||||
return statusNumber,published
|
return statusNumber,published
|
||||||
|
|
||||||
def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: str, https: bool, content: str, followersOnly: bool, saveToFile: bool, inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
|
def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: str, https: bool, content: str, followersOnly: bool, saveToFile: bool, inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}:
|
||||||
"""Creates a public post
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
prefix='https'
|
prefix='https'
|
||||||
if not https:
|
if not https:
|
||||||
|
@ -271,7 +271,6 @@ def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: s
|
||||||
'actor': prefix+'://'+domain+'/users/'+username,
|
'actor': prefix+'://'+domain+'/users/'+username,
|
||||||
'published': published,
|
'published': published,
|
||||||
'to': [toUrl],
|
'to': [toUrl],
|
||||||
'cc': [ccUrl],
|
|
||||||
'object': {'id': newPostId,
|
'object': {'id': newPostId,
|
||||||
'type': 'Note',
|
'type': 'Note',
|
||||||
'summary': summary,
|
'summary': summary,
|
||||||
|
@ -280,7 +279,6 @@ def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: s
|
||||||
'url': prefix+'://'+domain+'/@'+username+'/'+statusNumber,
|
'url': prefix+'://'+domain+'/@'+username+'/'+statusNumber,
|
||||||
'attributedTo': prefix+'://'+domain+'/users/'+username,
|
'attributedTo': prefix+'://'+domain+'/users/'+username,
|
||||||
'to': [toUrl],
|
'to': [toUrl],
|
||||||
'cc': [ccUrl],
|
|
||||||
'sensitive': sensitive,
|
'sensitive': sensitive,
|
||||||
'atomUri': prefix+'://'+domain+'/users/'+username+'/statuses/'+statusNumber,
|
'atomUri': prefix+'://'+domain+'/users/'+username+'/statuses/'+statusNumber,
|
||||||
'inReplyToAtomUri': inReplyToAtomUri,
|
'inReplyToAtomUri': inReplyToAtomUri,
|
||||||
|
@ -302,6 +300,10 @@ def createPostBase(baseDir: str,username: str, domain: str, toUrl: str, ccUrl: s
|
||||||
#}
|
#}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ccUrl:
|
||||||
|
if len(ccUrl)>0:
|
||||||
|
newPost['cc']=ccUrl
|
||||||
|
newPost['object']['cc']=ccUrl
|
||||||
if saveToFile:
|
if saveToFile:
|
||||||
outboxDir = createOutboxDir(username,domain,baseDir)
|
outboxDir = createOutboxDir(username,domain,baseDir)
|
||||||
filename=outboxDir+'/'+newPostId.replace('/','#')+'.json'
|
filename=outboxDir+'/'+newPostId.replace('/','#')+'.json'
|
||||||
|
@ -368,6 +370,8 @@ def sendPost(session,baseDir: str,username: str, domain: str, port: int, toUsern
|
||||||
if not toPersonId:
|
if not toPersonId:
|
||||||
return 4
|
return 4
|
||||||
|
|
||||||
|
print('*************Creating post')
|
||||||
|
print('toPersonId: '+toPersonId)
|
||||||
postJsonObject=createPostBase(username, domain, toPersonId, cc, https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject)
|
postJsonObject=createPostBase(username, domain, toPersonId, cc, https, content, followersOnly, saveToFile, inReplyTo, inReplyToAtomUri, subject)
|
||||||
|
|
||||||
# get the senders private key
|
# get the senders private key
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -186,7 +186,7 @@ def testPostMessageBetweenServers():
|
||||||
subject=None
|
subject=None
|
||||||
aliceSendThreads = []
|
aliceSendThreads = []
|
||||||
alicePostLog = []
|
alicePostLog = []
|
||||||
sendResult = sendPost(sessionAlice,aliceDir,'alice', '127.0.0.1', alicePort, 'bob', '127.0.0.1', bobPort, '', https, 'Why is a mouse when it spins?', False, True, federationList, aliceSendThreads, alicePostLog, inReplyTo, inReplyToAtomUri, subject)
|
sendResult = sendPost(sessionAlice,aliceDir,'alice', '127.0.0.1', alicePort, 'bob', '127.0.0.1', bobPort, None, https, 'Why is a mouse when it spins?', False, True, federationList, aliceSendThreads, alicePostLog, inReplyTo, inReplyToAtomUri, subject)
|
||||||
print('sendResult: '+str(sendResult))
|
print('sendResult: '+str(sendResult))
|
||||||
|
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
|
|
Loading…
Reference in New Issue