aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-25 03:36:51 -0500
committerBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-25 03:36:51 -0500
commit0f6846c3609c3b8caa34a296355e06d18261a1e1 (patch)
tree4fc46a36625b844f3c65ddd7b6062ea01b23efe0 /server.py
parent90b5573f842e1be81743194705fa94c41969da61 (diff)
downloadbbj-0f6846c3609c3b8caa34a296355e06d18261a1e1.tar.gz
add new parameter to threads: last_author
Diffstat (limited to 'server.py')
-rw-r--r--server.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/server.py b/server.py
index aa88cdd..d20432f 100644
--- a/server.py
+++ b/server.py
@@ -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
Un proyecto texto-plano.xyz