Set news flag on blog posts

main
Bob Mottram 2020-11-27 19:52:01 +00:00
parent b647a38910
commit 5a695d689d
1 changed files with 8 additions and 0 deletions

View File

@ -580,8 +580,16 @@ def savePostToBox(baseDir: str, httpPrefix: str, postId: str,
postJsonObject['object']['id'] = postId postJsonObject['object']['id'] = postId
postJsonObject['object']['atomUri'] = postId postJsonObject['object']['atomUri'] = postId
# for blog posts set the news flag
if postId and postJsonObject['object'].get('type'):
if boxname == 'tlblogs' and \
postJsonObject['object']['type'] == 'Article':
if '://' + originalDomain + '/' in postId:
postJsonObject['news'] = True
boxDir = createPersonDir(nickname, domain, baseDir, boxname) boxDir = createPersonDir(nickname, domain, baseDir, boxname)
filename = boxDir + '/' + postId.replace('/', '#') + '.json' filename = boxDir + '/' + postId.replace('/', '#') + '.json'
saveJson(postJsonObject, filename) saveJson(postJsonObject, filename)
return filename return filename