mirror of https://gitlab.com/bashrc2/epicyon
Support event objects
parent
fb0fd99941
commit
d77e4ea9fc
2
inbox.py
2
inbox.py
|
@ -1860,7 +1860,7 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
|
|||
if debug:
|
||||
print('DEBUG: Question update was received')
|
||||
return True
|
||||
elif message_json['object']['type'] == 'Note':
|
||||
elif message_json['object']['type'] in ('Note', 'Event'):
|
||||
if message_json['object'].get('id'):
|
||||
domain_full = get_full_domain(domain, port)
|
||||
if receive_edit_to_post(recent_posts_cache, message_json,
|
||||
|
|
|
@ -469,7 +469,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
|
||||
is_edited_post = False
|
||||
if message_json['type'] == 'Update' and \
|
||||
message_json['object']['type'] == 'Note':
|
||||
message_json['object']['type'] in ('Note', 'Event'):
|
||||
is_edited_post = True
|
||||
message_json['type'] = 'Create'
|
||||
|
||||
|
@ -539,7 +539,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
|
||||
# The following activity types get added to the index files
|
||||
indexed_activities = (
|
||||
'Create', 'Question', 'Note', 'EncryptedMessage', 'Article',
|
||||
'Create', 'Question', 'Note', 'Event', 'EncryptedMessage', 'Article',
|
||||
'Patch', 'Announce', 'ChatMessage'
|
||||
)
|
||||
if message_json['type'] in indexed_activities:
|
||||
|
|
17
posts.py
17
posts.py
|
@ -455,7 +455,7 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
|||
if debug:
|
||||
print('No type')
|
||||
return False
|
||||
allowed_post_types = ('Create', 'Announce', 'Page', 'Note')
|
||||
allowed_post_types = ('Create', 'Announce', 'Page', 'Note', 'Event')
|
||||
if item['type'] not in allowed_post_types:
|
||||
if debug:
|
||||
print('Not a Create/Note/Announce type')
|
||||
|
@ -476,7 +476,7 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
|||
if debug:
|
||||
print('object is not a dict or string')
|
||||
return False
|
||||
elif item['type'] == 'Note' or item['type'] == 'Page':
|
||||
elif item['type'] in ('Note', 'Event', 'Page'):
|
||||
if not item.get('published'):
|
||||
if debug:
|
||||
print('No published attribute 3')
|
||||
|
@ -488,7 +488,7 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
|||
# check that this is a public post
|
||||
# #Public should appear in the "to" list
|
||||
item_is_note = False
|
||||
if item['type'] == 'Note' or item['type'] == 'Page':
|
||||
if item['type'] in ('Note', 'Event', 'Page'):
|
||||
item_is_note = True
|
||||
|
||||
if isinstance(this_item, dict):
|
||||
|
@ -617,7 +617,7 @@ def _get_posts(session, outbox_url: str, max_posts: int,
|
|||
|
||||
this_item = item
|
||||
this_item_type = item['type']
|
||||
if this_item_type not in ('Note', 'Page'):
|
||||
if this_item_type not in ('Note', 'Event', 'Page'):
|
||||
this_item = item['object']
|
||||
if isinstance(this_item, str):
|
||||
if '://' in this_item:
|
||||
|
@ -4318,11 +4318,8 @@ def is_image_media(session, base_dir: str, http_prefix: str,
|
|||
return False
|
||||
if post_json_object['object'].get('moderationStatus'):
|
||||
return False
|
||||
if post_json_object['object']['type'] != 'Note' and \
|
||||
post_json_object['object']['type'] != 'Page' and \
|
||||
post_json_object['object']['type'] != 'Event' and \
|
||||
post_json_object['object']['type'] != 'ChatMessage' and \
|
||||
post_json_object['object']['type'] != 'Article':
|
||||
if post_json_object['object']['type'] not in ('Note', 'Page', 'Event',
|
||||
'ChatMessage', 'Article'):
|
||||
return False
|
||||
if not post_json_object['object'].get('attachment'):
|
||||
return False
|
||||
|
@ -5825,7 +5822,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
|||
base_dir, nickname, domain, post_id,
|
||||
recent_posts_cache)
|
||||
return None
|
||||
if announced_json['type'] not in ('Note', 'Page',
|
||||
if announced_json['type'] not in ('Note', 'Event', 'Page',
|
||||
'Question', 'Article'):
|
||||
print('WARN: announced post is not Note/Page/Article/Question ' +
|
||||
str(announced_json))
|
||||
|
|
11
utils.py
11
utils.py
|
@ -2382,11 +2382,10 @@ def is_dm(post_json_object: {}) -> bool:
|
|||
if not has_object_dict(post_json_object):
|
||||
return False
|
||||
if post_json_object['object']['type'] != 'ChatMessage':
|
||||
if post_json_object['object']['type'] != 'Note' and \
|
||||
post_json_object['object']['type'] != 'Page' and \
|
||||
post_json_object['object']['type'] != 'Patch' and \
|
||||
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
||||
post_json_object['object']['type'] != 'Article':
|
||||
if post_json_object['object']['type'] not in ('Note', 'Event',
|
||||
'Page', 'Patch',
|
||||
'EncryptedMessage',
|
||||
'Article'):
|
||||
return False
|
||||
if post_json_object['object'].get('moderationStatus'):
|
||||
return False
|
||||
|
@ -3474,7 +3473,7 @@ def is_reply(post_json_object: {}, actor: str) -> bool:
|
|||
return False
|
||||
if post_json_object['object'].get('moderationStatus'):
|
||||
return False
|
||||
if post_json_object['object']['type'] not in ('Note', 'Page',
|
||||
if post_json_object['object']['type'] not in ('Note', 'Event', 'Page',
|
||||
'EncryptedMessage',
|
||||
'ChatMessage', 'Article'):
|
||||
return False
|
||||
|
|
|
@ -144,7 +144,7 @@ def _valid_profile_preview_post(post_json_object: {},
|
|||
if not has_object_dict(post_json_object):
|
||||
return False, None
|
||||
if post_json_object['type'] not in ('Create', 'Announce'):
|
||||
if post_json_object['type'] not in ('Note', 'Video', 'Page'):
|
||||
if post_json_object['type'] not in ('Note', 'Event', 'Video', 'Page'):
|
||||
return False, None
|
||||
if not post_json_object.get('to'):
|
||||
return False, None
|
||||
|
|
Loading…
Reference in New Issue