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:
|
if debug:
|
||||||
print('DEBUG: Question update was received')
|
print('DEBUG: Question update was received')
|
||||||
return True
|
return True
|
||||||
elif message_json['object']['type'] == 'Note':
|
elif message_json['object']['type'] in ('Note', 'Event'):
|
||||||
if message_json['object'].get('id'):
|
if message_json['object'].get('id'):
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
if receive_edit_to_post(recent_posts_cache, message_json,
|
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
|
is_edited_post = False
|
||||||
if message_json['type'] == 'Update' and \
|
if message_json['type'] == 'Update' and \
|
||||||
message_json['object']['type'] == 'Note':
|
message_json['object']['type'] in ('Note', 'Event'):
|
||||||
is_edited_post = True
|
is_edited_post = True
|
||||||
message_json['type'] = 'Create'
|
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
|
# The following activity types get added to the index files
|
||||||
indexed_activities = (
|
indexed_activities = (
|
||||||
'Create', 'Question', 'Note', 'EncryptedMessage', 'Article',
|
'Create', 'Question', 'Note', 'Event', 'EncryptedMessage', 'Article',
|
||||||
'Patch', 'Announce', 'ChatMessage'
|
'Patch', 'Announce', 'ChatMessage'
|
||||||
)
|
)
|
||||||
if message_json['type'] in indexed_activities:
|
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:
|
if debug:
|
||||||
print('No type')
|
print('No type')
|
||||||
return False
|
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 item['type'] not in allowed_post_types:
|
||||||
if debug:
|
if debug:
|
||||||
print('Not a Create/Note/Announce type')
|
print('Not a Create/Note/Announce type')
|
||||||
|
@ -476,7 +476,7 @@ def _is_public_feed_post(item: {}, person_posts: {}, 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' or item['type'] == 'Page':
|
elif item['type'] in ('Note', 'Event', 'Page'):
|
||||||
if not item.get('published'):
|
if not item.get('published'):
|
||||||
if debug:
|
if debug:
|
||||||
print('No published attribute 3')
|
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
|
# check that this is a public post
|
||||||
# #Public should appear in the "to" list
|
# #Public should appear in the "to" list
|
||||||
item_is_note = False
|
item_is_note = False
|
||||||
if item['type'] == 'Note' or item['type'] == 'Page':
|
if item['type'] in ('Note', 'Event', 'Page'):
|
||||||
item_is_note = True
|
item_is_note = True
|
||||||
|
|
||||||
if isinstance(this_item, dict):
|
if isinstance(this_item, dict):
|
||||||
|
@ -617,7 +617,7 @@ def _get_posts(session, outbox_url: str, max_posts: int,
|
||||||
|
|
||||||
this_item = item
|
this_item = item
|
||||||
this_item_type = item['type']
|
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']
|
this_item = item['object']
|
||||||
if isinstance(this_item, str):
|
if isinstance(this_item, str):
|
||||||
if '://' in this_item:
|
if '://' in this_item:
|
||||||
|
@ -4318,11 +4318,8 @@ def is_image_media(session, base_dir: str, http_prefix: str,
|
||||||
return False
|
return False
|
||||||
if post_json_object['object'].get('moderationStatus'):
|
if post_json_object['object'].get('moderationStatus'):
|
||||||
return False
|
return False
|
||||||
if post_json_object['object']['type'] != 'Note' and \
|
if post_json_object['object']['type'] not in ('Note', 'Page', 'Event',
|
||||||
post_json_object['object']['type'] != 'Page' and \
|
'ChatMessage', 'Article'):
|
||||||
post_json_object['object']['type'] != 'Event' and \
|
|
||||||
post_json_object['object']['type'] != 'ChatMessage' and \
|
|
||||||
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'):
|
||||||
return False
|
return False
|
||||||
|
@ -5825,7 +5822,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
||||||
base_dir, nickname, domain, post_id,
|
base_dir, nickname, domain, post_id,
|
||||||
recent_posts_cache)
|
recent_posts_cache)
|
||||||
return None
|
return None
|
||||||
if announced_json['type'] not in ('Note', 'Page',
|
if announced_json['type'] not in ('Note', 'Event', 'Page',
|
||||||
'Question', 'Article'):
|
'Question', 'Article'):
|
||||||
print('WARN: announced post is not Note/Page/Article/Question ' +
|
print('WARN: announced post is not Note/Page/Article/Question ' +
|
||||||
str(announced_json))
|
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):
|
if not has_object_dict(post_json_object):
|
||||||
return False
|
return False
|
||||||
if post_json_object['object']['type'] != 'ChatMessage':
|
if post_json_object['object']['type'] != 'ChatMessage':
|
||||||
if post_json_object['object']['type'] != 'Note' and \
|
if post_json_object['object']['type'] not in ('Note', 'Event',
|
||||||
post_json_object['object']['type'] != 'Page' and \
|
'Page', 'Patch',
|
||||||
post_json_object['object']['type'] != 'Patch' and \
|
'EncryptedMessage',
|
||||||
post_json_object['object']['type'] != 'EncryptedMessage' and \
|
'Article'):
|
||||||
post_json_object['object']['type'] != 'Article':
|
|
||||||
return False
|
return False
|
||||||
if post_json_object['object'].get('moderationStatus'):
|
if post_json_object['object'].get('moderationStatus'):
|
||||||
return False
|
return False
|
||||||
|
@ -3474,7 +3473,7 @@ def is_reply(post_json_object: {}, actor: str) -> bool:
|
||||||
return False
|
return False
|
||||||
if post_json_object['object'].get('moderationStatus'):
|
if post_json_object['object'].get('moderationStatus'):
|
||||||
return False
|
return False
|
||||||
if post_json_object['object']['type'] not in ('Note', 'Page',
|
if post_json_object['object']['type'] not in ('Note', 'Event', 'Page',
|
||||||
'EncryptedMessage',
|
'EncryptedMessage',
|
||||||
'ChatMessage', 'Article'):
|
'ChatMessage', 'Article'):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -144,7 +144,7 @@ def _valid_profile_preview_post(post_json_object: {},
|
||||||
if not has_object_dict(post_json_object):
|
if not has_object_dict(post_json_object):
|
||||||
return False, None
|
return False, None
|
||||||
if post_json_object['type'] not in ('Create', 'Announce'):
|
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
|
return False, None
|
||||||
if not post_json_object.get('to'):
|
if not post_json_object.get('to'):
|
||||||
return False, None
|
return False, None
|
||||||
|
|
Loading…
Reference in New Issue