mirror of https://gitlab.com/bashrc2/epicyon
Support for receiving ChatMessage activities
Equivalent to a Note DMmerge-requests/30/head
parent
4daec86f2a
commit
edb01af961
|
@ -408,7 +408,7 @@ def post_message_to_outbox(session, translate: {},
|
||||||
# The following activity types get added to the index files
|
# The following activity types get added to the index files
|
||||||
indexed_activities = (
|
indexed_activities = (
|
||||||
'Create', 'Question', 'Note', 'EncryptedMessage', 'Article',
|
'Create', 'Question', 'Note', 'EncryptedMessage', 'Article',
|
||||||
'Patch', 'Announce'
|
'Patch', 'Announce', 'ChatMessage'
|
||||||
)
|
)
|
||||||
if message_json['type'] in indexed_activities:
|
if message_json['type'] in indexed_activities:
|
||||||
indexes = [outbox_name, "inbox"]
|
indexes = [outbox_name, "inbox"]
|
||||||
|
|
8
posts.py
8
posts.py
|
@ -484,9 +484,9 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
||||||
this_item = item['object']
|
this_item = 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
|
item_is_note = False
|
||||||
if item['type'] == 'Note' or item['type'] == 'Page':
|
if item['type'] == 'Note' or item['type'] == 'Page':
|
||||||
itemIsNote = True
|
item_is_note = True
|
||||||
|
|
||||||
if isinstance(this_item, dict):
|
if isinstance(this_item, dict):
|
||||||
if this_item.get('to'):
|
if this_item.get('to'):
|
||||||
|
@ -497,7 +497,7 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
||||||
break
|
break
|
||||||
if not is_public:
|
if not is_public:
|
||||||
return False
|
return False
|
||||||
elif isinstance(this_item, str) or itemIsNote:
|
elif isinstance(this_item, str) or item_is_note:
|
||||||
if item.get('to'):
|
if item.get('to'):
|
||||||
is_public = False
|
is_public = False
|
||||||
for recipient in item['to']:
|
for recipient in item['to']:
|
||||||
|
@ -3561,6 +3561,7 @@ def is_image_media(session, base_dir: str, http_prefix: str,
|
||||||
if post_json_object['object']['type'] != 'Note' and \
|
if post_json_object['object']['type'] != 'Note' and \
|
||||||
post_json_object['object']['type'] != 'Page' and \
|
post_json_object['object']['type'] != 'Page' and \
|
||||||
post_json_object['object']['type'] != 'Event' and \
|
post_json_object['object']['type'] != 'Event' and \
|
||||||
|
post_json_object['object']['type'] != 'ChatMessage' and \
|
||||||
post_json_object['object']['type'] != 'Article':
|
post_json_object['object']['type'] != 'Article':
|
||||||
return False
|
return False
|
||||||
if not post_json_object['object'].get('attachment'):
|
if not post_json_object['object'].get('attachment'):
|
||||||
|
@ -3583,6 +3584,7 @@ def _add_post_string_to_timeline(post_str: str, boxname: str,
|
||||||
# must be a recognized ActivityPub type
|
# must be a recognized ActivityPub type
|
||||||
if ('"Note"' in post_str or
|
if ('"Note"' in post_str or
|
||||||
'"EncryptedMessage"' in post_str or
|
'"EncryptedMessage"' in post_str or
|
||||||
|
'"ChatMessage"' in post_str or
|
||||||
'"Event"' in post_str or
|
'"Event"' in post_str or
|
||||||
'"Article"' in post_str or
|
'"Article"' in post_str or
|
||||||
'"Patch"' in post_str or
|
'"Patch"' in post_str or
|
||||||
|
|
14
utils.py
14
utils.py
|
@ -2661,12 +2661,13 @@ def is_dm(post_json_object: {}) -> bool:
|
||||||
return False
|
return False
|
||||||
if not has_object_dict(post_json_object):
|
if not has_object_dict(post_json_object):
|
||||||
return False
|
return False
|
||||||
if post_json_object['object']['type'] != 'Note' and \
|
if post_json_object['object']['type'] != 'ChatMessage':
|
||||||
post_json_object['object']['type'] != 'Page' and \
|
if post_json_object['object']['type'] != 'Note' and \
|
||||||
post_json_object['object']['type'] != 'Patch' and \
|
post_json_object['object']['type'] != 'Page' and \
|
||||||
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
post_json_object['object']['type'] != 'Patch' and \
|
||||||
post_json_object['object']['type'] != 'Article':
|
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
||||||
return False
|
post_json_object['object']['type'] != 'Article':
|
||||||
|
return False
|
||||||
if post_json_object['object'].get('moderationStatus'):
|
if post_json_object['object'].get('moderationStatus'):
|
||||||
return False
|
return False
|
||||||
fields = ('to', 'cc')
|
fields = ('to', 'cc')
|
||||||
|
@ -2693,6 +2694,7 @@ def is_reply(post_json_object: {}, actor: str) -> bool:
|
||||||
if post_json_object['object']['type'] != 'Note' and \
|
if post_json_object['object']['type'] != 'Note' and \
|
||||||
post_json_object['object']['type'] != 'Page' and \
|
post_json_object['object']['type'] != 'Page' and \
|
||||||
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
||||||
|
post_json_object['object']['type'] != 'ChatMessage' and \
|
||||||
post_json_object['object']['type'] != 'Article':
|
post_json_object['object']['type'] != 'Article':
|
||||||
return False
|
return False
|
||||||
if post_json_object['object'].get('inReplyTo'):
|
if post_json_object['object'].get('inReplyTo'):
|
||||||
|
|
Loading…
Reference in New Issue