patch_comment: return new ratings in response

This way the client can show these without querying Pillar again.
This commit is contained in:
Sybren A. Stüvel 2016-07-28 10:24:01 +02:00
parent 6a7d25cec7
commit 7365fb10cd

View File

@ -92,7 +92,15 @@ def patch_comment(node_id, patch):
else: else:
result = nodes_coll.update_one({'_id': node_id}, mongo_update) result = nodes_coll.update_one({'_id': node_id}, mongo_update)
return jsonify({'_status': 'OK', 'result': result}) # Fetch the new ratings, so the client can show these without querying again.
node = nodes_coll.find_one(node_id,
projection={'properties.rating_positive': 1,
'properties.rating_negative': 1})
return jsonify({'_status': 'OK',
'result': result,
'properties': node['properties']
})
def assert_is_valid_patch(node_id, patch): def assert_is_valid_patch(node_id, patch):