diff options
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]) |