Page avtivity type

merge-requests/30/head
Bob Mottram 2021-11-18 18:43:58 +00:00
parent 3bb8a7958e
commit 2ce93f24d7
4 changed files with 14 additions and 4 deletions

1
git.py
View File

@ -50,6 +50,7 @@ def isGitPatch(baseDir: str, nickname: str, domain: str,
"""Is the given post content a git patch? """Is the given post content a git patch?
""" """
if messageType != 'Note' and \ if messageType != 'Note' and \
messageType != 'Page' and \
messageType != 'Patch': messageType != 'Patch':
return False return False
# must have a subject line # must have a subject line

View File

@ -446,6 +446,7 @@ def _isPublicFeedPost(item: {}, personPosts: {}, debug: bool) -> bool:
return False return False
if item['type'] != 'Create' and \ if item['type'] != 'Create' and \
item['type'] != 'Announce' and \ item['type'] != 'Announce' and \
item['type'] != 'Page' and \
item['type'] != 'Note': item['type'] != 'Note':
if debug: if debug:
print('Not a Create/Note/Announce type') print('Not a Create/Note/Announce type')
@ -465,7 +466,7 @@ def _isPublicFeedPost(item: {}, personPosts: {}, debug: bool) -> bool:
if debug: if debug:
print('object is not a dict or string') print('object is not a dict or string')
return False return False
elif item['type'] == 'Note': elif item['type'] == 'Note' or item['type'] == 'Page':
if not item.get('published'): if not item.get('published'):
if debug: if debug:
print('No published attribute') print('No published attribute')
@ -476,6 +477,10 @@ def _isPublicFeedPost(item: {}, personPosts: {}, debug: bool) -> bool:
thisItem = item['object'] thisItem = item['object']
# check that this is a public post # check that this is a public post
# #Public should appear in the "to" list # #Public should appear in the "to" list
itemIsNote = False
if item['type'] == 'Note' or item['type'] == 'Page':
itemIsNote = True
if isinstance(thisItem, dict): if isinstance(thisItem, dict):
if thisItem.get('to'): if thisItem.get('to'):
isPublic = False isPublic = False
@ -485,7 +490,7 @@ def _isPublicFeedPost(item: {}, personPosts: {}, debug: bool) -> bool:
break break
if not isPublic: if not isPublic:
return False return False
elif isinstance(thisItem, str) or item['type'] == 'Note': elif isinstance(thisItem, str) or itemIsNote:
if item.get('to'): if item.get('to'):
isPublic = False isPublic = False
for recipient in item['to']: for recipient in item['to']:
@ -581,7 +586,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
continue continue
thisItem = item thisItem = item
if item['type'] != 'Note': if item['type'] != 'Note' and item['type'] != 'Page':
thisItem = item['object'] thisItem = item['object']
content = getBaseContentFromPost(item, systemLanguage) content = getBaseContentFromPost(item, systemLanguage)
@ -3409,6 +3414,7 @@ def isImageMedia(session, baseDir: str, httpPrefix: str,
if postJsonObject['object'].get('moderationStatus'): if postJsonObject['object'].get('moderationStatus'):
return False return False
if postJsonObject['object']['type'] != 'Note' and \ if postJsonObject['object']['type'] != 'Note' and \
postJsonObject['object']['type'] != 'Page' and \
postJsonObject['object']['type'] != 'Event' and \ postJsonObject['object']['type'] != 'Event' and \
postJsonObject['object']['type'] != 'Article': postJsonObject['object']['type'] != 'Article':
return False return False
@ -4555,6 +4561,7 @@ def downloadAnnounce(session, baseDir: str, httpPrefix: str,
recentPostsCache) recentPostsCache)
return None return None
if announcedJson['type'] != 'Note' and \ if announcedJson['type'] != 'Note' and \
announcedJson['type'] != 'Page' and \
announcedJson['type'] != 'Article': announcedJson['type'] != 'Article':
# You can only announce Note or Article types # You can only announce Note or Article types
_rejectAnnounce(announceFilename, _rejectAnnounce(announceFilename,

View File

@ -2583,6 +2583,7 @@ def isDM(postJsonObject: {}) -> bool:
if not hasObjectDict(postJsonObject): if not hasObjectDict(postJsonObject):
return False return False
if postJsonObject['object']['type'] != 'Note' and \ if postJsonObject['object']['type'] != 'Note' and \
postJsonObject['object']['type'] != 'Page' and \
postJsonObject['object']['type'] != 'Patch' and \ postJsonObject['object']['type'] != 'Patch' and \
postJsonObject['object']['type'] != 'EncryptedMessage' and \ postJsonObject['object']['type'] != 'EncryptedMessage' and \
postJsonObject['object']['type'] != 'Article': postJsonObject['object']['type'] != 'Article':
@ -2611,6 +2612,7 @@ def isReply(postJsonObject: {}, actor: str) -> bool:
if postJsonObject['object'].get('moderationStatus'): if postJsonObject['object'].get('moderationStatus'):
return False return False
if postJsonObject['object']['type'] != 'Note' and \ if postJsonObject['object']['type'] != 'Note' and \
postJsonObject['object']['type'] != 'Page' and \
postJsonObject['object']['type'] != 'EncryptedMessage' and \ postJsonObject['object']['type'] != 'EncryptedMessage' and \
postJsonObject['object']['type'] != 'Article': postJsonObject['object']['type'] != 'Article':
return False return False

View File

@ -291,7 +291,7 @@ def htmlProfileAfterSearch(cssCache: {},
if not hasObjectDict(item): if not hasObjectDict(item):
continue continue
if item['type'] != 'Create' and item['type'] != 'Announce': if item['type'] != 'Create' and item['type'] != 'Announce':
if item['type'] != 'Note': if item['type'] != 'Note' and item['type'] != 'Page':
continue continue
if not item.get('to'): if not item.get('to'):
continue continue