Indicate that imported posts contain news

merge-requests/8/head
Bob Mottram 2020-10-08 10:07:45 +01:00
parent 9e802d52eb
commit eca0cbe982
3 changed files with 22 additions and 12 deletions

View File

@ -105,6 +105,7 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
idStr = \ idStr = \
httpPrefix + '://' + domain + '/users/news' + \ httpPrefix + '://' + domain + '/users/news' + \
'/statuses/' + statusNumber + '/replies' '/statuses/' + statusNumber + '/replies'
blog['news'] = True
blog['object']['replies']['id'] = idStr blog['object']['replies']['id'] = idStr
blog['object']['replies']['first']['partOf'] = idStr blog['object']['replies']['first']['partOf'] = idStr

View File

@ -979,6 +979,12 @@ def isBlogPost(postJsonObject: {}) -> bool:
return True return True
def isNewsPost(postJsonObject: {}) -> bool:
"""Is the given post a blog post?
"""
return postJsonObject.get('news')
def searchBoxPosts(baseDir: str, nickname: str, domain: str, def searchBoxPosts(baseDir: str, nickname: str, domain: str,
searchStr: str, maxResults: int, searchStr: str, maxResults: int,
boxName='outbox') -> []: boxName='outbox') -> []:

View File

@ -30,6 +30,7 @@ from utils import getProtocolPrefixes
from utils import searchBoxPosts from utils import searchBoxPosts
from utils import isEventPost from utils import isEventPost
from utils import isBlogPost from utils import isBlogPost
from utils import isNewsPost
from utils import updateRecentPostsCache from utils import updateRecentPostsCache
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import getDomainFromActor from utils import getDomainFromActor
@ -4512,10 +4513,12 @@ def individualPostAsHtml(allowDownloads: bool,
if fullDomain + '/users/' + nickname in postJsonObject['actor']: if fullDomain + '/users/' + nickname in postJsonObject['actor']:
if '/statuses/' in postJsonObject['object']['id']: if '/statuses/' in postJsonObject['object']['id']:
if isBlogPost(postJsonObject): if isBlogPost(postJsonObject):
if not isNewsPost(postJsonObject):
blogPostId = postJsonObject['object']['id'] blogPostId = postJsonObject['object']['id']
editStr += \ editStr += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + nickname + \ '<a class="imageAnchor" href="/users/' + \
nickname + \
'/tlblogs?editblogpost=' + \ '/tlblogs?editblogpost=' + \
blogPostId.split('/statuses/')[1] + \ blogPostId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \