diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2014-10-09 10:49:40 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2014-10-09 10:49:40 +0200 |
commit | ba8024b667a4ca16305e3b8c6fe566ba328a488d (patch) | |
tree | 508cf331572ddfd75d3e4c40808a031e492c99e4 /service/pixelated/user_agent.py | |
parent | c77b5aeb93fb61c2ec67d89f7a1266418fff5a9a (diff) |
Skip default tags for tag suggestions.
- Fixup for issue #52
Diffstat (limited to 'service/pixelated/user_agent.py')
-rw-r--r-- | service/pixelated/user_agent.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py index 12b9a97a..03372f23 100644 --- a/service/pixelated/user_agent.py +++ b/service/pixelated/user_agent.py @@ -124,12 +124,17 @@ def delete_mails(): @app.route('/tags') def tags(): + tag_service = mail_service.tag_service + query = request.args.get('q') + skipDefaultTags = request.args.get('skipDefaultTags') + + all_tags = tag_service.all_custom_tags() if skipDefaultTags else tag_service.all_tags() if query: - tags = [tag for tag in mail_service.all_tags() if bool(re.match(query, tag.name, re.IGNORECASE))] + tags = [tag for tag in all_tags if bool(re.match(query, tag.name, re.IGNORECASE))] else: - tags = mail_service.all_tags() + tags = all_tags return respond_json([tag.as_dict() for tag in tags]) |