Join activity has the same meaning as Follow

merge-requests/17/head
Bob Mottram 2021-02-08 14:48:37 +00:00
parent 98a1d70565
commit ae0b1505f9
4 changed files with 12 additions and 7 deletions

View File

@ -77,7 +77,8 @@ def _acceptFollow(baseDir: str, domain: str, messageJson: {},
if not messageJson['object'].get('type'):
return
if not messageJson['object']['type'] == 'Follow':
return
if not messageJson['object']['type'] == 'Join':
return
if debug:
print('DEBUG: receiving Follow activity')
if not messageJson['object'].get('actor'):

View File

@ -598,7 +598,8 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str,
"""Receives a follow request within the POST section of HTTPServer
"""
if not messageJson['type'].startswith('Follow'):
return False
if not messageJson['type'].startswith('Join'):
return False
print('Receiving follow request')
if not messageJson.get('actor'):
if debug:
@ -1162,7 +1163,8 @@ def outboxUndoFollow(baseDir: str, messageJson: {}, debug: bool) -> None:
if not messageJson['object'].get('type'):
return
if not messageJson['object']['type'] == 'Follow':
return
if not messageJson['object']['type'] == 'Join':
return
if not messageJson['object'].get('object'):
return
if not messageJson['object'].get('actor'):

View File

@ -275,7 +275,7 @@ def inboxMessageHasParams(messageJson: {}) -> bool:
# param + ' ' + str(messageJson))
return False
if not messageJson.get('to'):
allowedWithoutToParam = ['Like', 'Follow', 'Request',
allowedWithoutToParam = ['Like', 'Follow', 'Join', 'Request',
'Accept', 'Capability', 'Undo']
if messageJson['type'] not in allowedWithoutToParam:
return False
@ -297,7 +297,7 @@ def inboxPermittedMessage(domain: str, messageJson: {},
if not urlPermitted(actor, federationList):
return False
alwaysAllowedTypes = ('Follow', 'Like', 'Delete', 'Announce')
alwaysAllowedTypes = ('Follow', 'Join', 'Like', 'Delete', 'Announce')
if messageJson['type'] not in alwaysAllowedTypes:
if not messageJson.get('object'):
return True
@ -693,7 +693,8 @@ def _receiveUndo(session, baseDir: str, httpPrefix: str,
print('DEBUG: ' + messageJson['type'] +
' object within object is not a string')
return False
if messageJson['object']['type'] == 'Follow':
if messageJson['object']['type'] == 'Follow' or \
messageJson['object']['type'] == 'Join':
return _receiveUndoFollow(session, baseDir, httpPrefix,
port, messageJson,
federationList, debug)

View File

@ -2414,7 +2414,8 @@ def sendToNamedAddresses(session, baseDir: str,
print('DEBUG: ' +
'no "to" field when sending to named addresses')
if postJsonObject['object'].get('type'):
if postJsonObject['object']['type'] == 'Follow':
if postJsonObject['object']['type'] == 'Follow' or \
postJsonObject['object']['type'] == 'Join':
if isinstance(postJsonObject['object']['object'], str):
if debug:
print('DEBUG: "to" field assigned to Follow')