Set published date on scheduled posts

merge-requests/30/head
Bob Mottram 2020-01-13 11:36:42 +00:00
parent fb3bb1bb33
commit 0f8da38844
1 changed files with 13 additions and 0 deletions

View File

@ -9,6 +9,7 @@ __status__ = "Production"
import os
import time
import datetime
from utils import getStatusNumber
from utils import loadJson
from outbox import postMessageToOutbox
@ -76,6 +77,17 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) ->
indexLines.remove(line)
continue
# set the published time
# If this is not recent then http checks on the receiving side
# will reject it
statusNumber,published = getStatusNumber()
if postJsonObject.get('published'):
postJsonObject['published']=published
if postJsonObject.get('object'):
if isinstance(postJsonObject['object'], dict):
if postJsonObject['object'].get('published'):
postJsonObject['published']=published
print('Sending scheduled post '+postId)
if not postMessageToOutbox(postJsonObject,nickname, \
@ -96,6 +108,7 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) ->
httpd.projectVersion, \
httpd.debug):
indexLines.remove(line)
os.remove(postFilename)
continue
# move to the outbox