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 = \
httpPrefix + '://' + domain + '/users/news' + \
'/statuses/' + statusNumber + '/replies'
blog['news'] = True
blog['object']['replies']['id'] = idStr
blog['object']['replies']['first']['partOf'] = idStr

View File

@ -979,6 +979,12 @@ def isBlogPost(postJsonObject: {}) -> bool:
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,
searchStr: str, maxResults: int,
boxName='outbox') -> []:

View File

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