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 createUnlistedPost
|
||||||
from posts import createFollowersOnlyPost
|
from posts import createFollowersOnlyPost
|
||||||
from posts import createDirectMessagePost
|
from posts import createDirectMessagePost
|
||||||
from posts import createReminderPost
|
|
||||||
from posts import populateRepliesJson
|
from posts import populateRepliesJson
|
||||||
from posts import addToField
|
from posts import addToField
|
||||||
from posts import expireCache
|
from posts import expireCache
|
||||||
|
@ -5439,10 +5438,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return -1
|
return -1
|
||||||
elif postType == 'newreminder':
|
elif postType == 'newreminder':
|
||||||
messageJson = None
|
messageJson = None
|
||||||
print('A reminder was posted for ' +
|
handle = nickname + '@' + self.server.domainFull
|
||||||
nickname + '@' + self.server.domainFull)
|
print('A reminder was posted for ' + handle)
|
||||||
|
if handle not in fields['message']:
|
||||||
|
fields['message'] = handle + ' ' + fields['message']
|
||||||
messageJson = \
|
messageJson = \
|
||||||
createReminderPost(self.server.baseDir,
|
createDirectMessagePost(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
self.server.port,
|
self.server.port,
|
||||||
|
@ -5452,20 +5453,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
filename, attachmentMediaType,
|
filename, attachmentMediaType,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
self.server.useBlurHash,
|
self.server.useBlurHash,
|
||||||
|
None, None,
|
||||||
fields['subject'],
|
fields['subject'],
|
||||||
True, fields['schedulePost'],
|
True, fields['schedulePost'],
|
||||||
fields['eventDate'],
|
fields['eventDate'],
|
||||||
fields['eventTime'],
|
fields['eventTime'],
|
||||||
fields['location'])
|
fields['location'])
|
||||||
if messageJson:
|
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']:
|
if fields['schedulePost']:
|
||||||
return 1
|
return 1
|
||||||
print('DEBUG: new reminder to ' +
|
print('DEBUG: new reminder to ' +
|
||||||
|
|
43
posts.py
43
posts.py
|
@ -1177,49 +1177,6 @@ def createDirectMessagePost(baseDir: str,
|
||||||
return messageJson
|
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,
|
def createReportPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str, followersOnly: bool, saveToFile: bool,
|
||||||
|
|
Loading…
Reference in New Issue