forked from indymedia/epicyon
Don't use a separate function for reminder posts
parent
e1470a7d37
commit
326fb9fc48
18
daemon.py
18
daemon.py
|
@ -66,7 +66,6 @@ from posts import createReportPost
|
|||
from posts import createUnlistedPost
|
||||
from posts import createFollowersOnlyPost
|
||||
from posts import createDirectMessagePost
|
||||
from posts import createReminderPost
|
||||
from posts import populateRepliesJson
|
||||
from posts import addToField
|
||||
from posts import expireCache
|
||||
|
@ -5439,10 +5438,12 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
return -1
|
||||
elif postType == 'newreminder':
|
||||
messageJson = None
|
||||
print('A reminder was posted for ' +
|
||||
nickname + '@' + self.server.domainFull)
|
||||
handle = nickname + '@' + self.server.domainFull
|
||||
print('A reminder was posted for ' + handle)
|
||||
if handle not in fields['message']:
|
||||
fields['message'] = handle + ' ' + fields['message']
|
||||
messageJson = \
|
||||
createReminderPost(self.server.baseDir,
|
||||
createDirectMessagePost(self.server.baseDir,
|
||||
nickname,
|
||||
self.server.domain,
|
||||
self.server.port,
|
||||
|
@ -5452,20 +5453,13 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
filename, attachmentMediaType,
|
||||
fields['imageDescription'],
|
||||
self.server.useBlurHash,
|
||||
None, None,
|
||||
fields['subject'],
|
||||
True, fields['schedulePost'],
|
||||
fields['eventDate'],
|
||||
fields['eventTime'],
|
||||
fields['location'])
|
||||
if messageJson:
|
||||
# ensure that this is only being sent to the author
|
||||
messageJson['object']['cc'] = []
|
||||
messageJson['cc'] = []
|
||||
messageJson['object']['to'] = [
|
||||
self.server.httpPrefix + ':\\' +
|
||||
self.server.domainFull + '/users/' + nickname
|
||||
]
|
||||
messageJson['to'] = messageJson['object']['to']
|
||||
if fields['schedulePost']:
|
||||
return 1
|
||||
print('DEBUG: new reminder to ' +
|
||||
|
|
43
posts.py
43
posts.py
|
@ -1177,49 +1177,6 @@ def createDirectMessagePost(baseDir: str,
|
|||
return messageJson
|
||||
|
||||
|
||||
def createReminderPost(baseDir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
httpPrefix: str,
|
||||
content: str, followersOnly: bool,
|
||||
saveToFile: bool, clientToServer: bool,
|
||||
attachImageFilename: str, mediaType: str,
|
||||
imageDescription: str, useBlurhash: bool,
|
||||
subject=None, debug=False,
|
||||
schedulePost=False,
|
||||
eventDate=None, eventTime=None,
|
||||
location=None) -> {}:
|
||||
"""Reminder post to self
|
||||
For example, adding something to your calendar to remind you of an event
|
||||
"""
|
||||
postTo = None
|
||||
postCc = None
|
||||
domainFull = domain
|
||||
if port:
|
||||
if port != 80 and port != 443:
|
||||
domainFull = domain + ':' + str(port)
|
||||
handle = '@' + nickname + '@' + domainFull
|
||||
if handle not in content:
|
||||
content = handle + ' ' + content
|
||||
messageJson = \
|
||||
createPostBase(baseDir, nickname, domain, port,
|
||||
postTo, postCc,
|
||||
httpPrefix, content, followersOnly, saveToFile,
|
||||
clientToServer,
|
||||
attachImageFilename, mediaType,
|
||||
imageDescription, useBlurhash,
|
||||
False, False, None, None, subject,
|
||||
schedulePost, eventDate, eventTime, location)
|
||||
# mentioned recipients go into To rather than Cc
|
||||
messageJson['to'] = messageJson['object']['cc']
|
||||
messageJson['object']['to'] = messageJson['to']
|
||||
messageJson['cc'] = []
|
||||
messageJson['object']['cc'] = []
|
||||
if schedulePost:
|
||||
savePostToBox(baseDir, httpPrefix, messageJson['object']['id'],
|
||||
nickname, domain, messageJson, 'scheduled')
|
||||
return messageJson
|
||||
|
||||
|
||||
def createReportPost(baseDir: str,
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
content: str, followersOnly: bool, saveToFile: bool,
|
||||
|
|
Loading…
Reference in New Issue