events: Extract post_process_state.

This is a preparatory refactor for potentially being able to call this
from the web-public archive feature's code path.
This commit is contained in:
Tim Abbott
2018-05-06 22:42:01 -07:00
parent 112805251f
commit 6317e4d63c

View File

@@ -663,6 +663,15 @@ def do_events_register(user_profile: UserProfile, user_client: Client,
client_gravatar=client_gravatar,
fetch_event_types=fetch_event_types)
post_process_state(ret)
if len(events) > 0:
ret['last_event_id'] = events[-1]['id']
else:
ret['last_event_id'] = -1
return ret
def post_process_state(ret: Dict[str, Any]) -> None:
'''
NOTE:
@@ -701,9 +710,3 @@ def do_events_register(user_profile: UserProfile, user_client: Client,
d.pop('is_active')
del ret['raw_users']
if len(events) > 0:
ret['last_event_id'] = events[-1]['id']
else:
ret['last_event_id'] = -1
return ret