diff options
author | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-25 03:36:51 -0500 |
---|---|---|
committer | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-25 03:36:51 -0500 |
commit | 0f6846c3609c3b8caa34a296355e06d18261a1e1 (patch) | |
tree | 4fc46a36625b844f3c65ddd7b6062ea01b23efe0 /server.py | |
parent | 90b5573f842e1be81743194705fa94c41969da61 (diff) | |
download | bbj-0f6846c3609c3b8caa34a296355e06d18261a1e1.tar.gz |
add new parameter to threads: last_author
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -87,24 +87,25 @@ def api_method(function): return wrapper -def create_usermap(connection, obj): +def create_usermap(connection, obj, index=False): """ Creates a mapping of all the user_ids that occur in OBJ to their full user objects (names, profile info, etc). Can be a thread_index or a messages object from one. """ - + user_set = {item["author"] for item in obj} + if index: + [user_set.add(item["last_author"]) for item in obj] return { user_id: db.user_resolve( connection, user_id, externalize=True, return_false=False) - for user_id in {item["author"] for item in obj} + for user_id in user_set } - def validate(json, args): """ Ensure the json object contains all the keys needed to satisfy @@ -206,7 +207,7 @@ class API(object): Requires no arguments. """ threads = db.thread_index(database) - cherrypy.thread_data.usermap = create_usermap(database, threads) + cherrypy.thread_data.usermap = create_usermap(database, threads, True) return threads |