From 84b459545411bd708c2a0b6de139ea3ab8e9101f Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 7 Jan 2021 22:52:42 -0800 Subject: [PATCH] Let /tag/tagname.json only return the one main tag, not list. Previously, the whole walk tree was returned. This can be convenient because you get the whole descendant tree all at once, but it's unusual since all the other individual .json endpoints only return a single object, not a list. --- .../etiquette_flask/backend/endpoints/tag_endpoints.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py index c7a63b3..ff3d724 100644 --- a/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/tag_endpoints.py @@ -146,13 +146,13 @@ def get_tags_json(specific_tag_name=None): include_synonyms = request.args.get('synonyms') include_synonyms = include_synonyms is None or etiquette.helpers.truthystring(include_synonyms) - if specific_tag is None: - tags = list(common.P.get_tags()) + if specific_tag: + response = specific_tag.jsonify(include_synonyms=include_synonyms) else: - tags = list(specific_tag.walk_children()) + tags = list(common.P.get_tags()) + response = [tag.jsonify(include_synonyms=include_synonyms) for tag in tags] - tags = [tag.jsonify(include_synonyms=include_synonyms) for tag in tags] - return jsonify.make_json_response(tags) + return jsonify.make_json_response(response) # Tag create and delete ############################################################################