We don't want bookmarklet users adding random tags. Instead, restrict
them to tags that are already in the database, which allows us to keep
a consistent tag-set and present a simpler UI. The hard-coded
_AVAILABLE_TAGS will be replaced by a notmuch query once I finish with
the UI.
flask_cors.CORS(app)
+_AVAILABLE_TAGS = {
+ 'bug',
+ 'needs-review',
+ 'obsolete',
+ 'patch',
+ }
_TAGS = {}
+@app.route('/tags', methods=['GET'])
+def tags():
+ return flask.Response(
+ response=json.dumps(sorted(_AVAILABLE_TAGS)),
+ mimetype='application/json')
+
+
@app.route('/mid/<message_id>', methods=['GET', 'POST'])
def message_id_tags(message_id):
if flask.request.method == 'POST':