summaryrefslogtreecommitdiff
path: root/service/app/pixelated_user_agent.py
diff options
context:
space:
mode:
authorBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-14 14:02:49 -0300
committerBruno Wagner Goncalves <bwagner@thoughtworks.com>2014-08-14 14:02:49 -0300
commitff6aafebcc40d3b734da794e732a0b1cd3526964 (patch)
treeabb750b4da9c340fdf2868203f5f9d46ca5c7d08 /service/app/pixelated_user_agent.py
parentb5e0973245c2af1c5c9d67f5f15eeb00a93cfc93 (diff)
Update mail tags are now on the right place
Diffstat (limited to 'service/app/pixelated_user_agent.py')
-rw-r--r--service/app/pixelated_user_agent.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/service/app/pixelated_user_agent.py b/service/app/pixelated_user_agent.py
index 2d0dc4b8..7f13809a 100644
--- a/service/app/pixelated_user_agent.py
+++ b/service/app/pixelated_user_agent.py
@@ -88,21 +88,23 @@ def delete_mails(mail_id):
@app.route('/tags')
def tags():
- tags = Tags()
+ tags = mail_service.all_tags()
return respond_json(tags.as_dict())
@app.route('/mail/<mail_id>')
def mail(mail_id):
mail = mail_service.mail(mail_id)
- mail = PixelatedMail(mail)
return respond_json(mail.as_dict())
-@app.route('/mail/<mail_id>/tags')
+@app.route('/mail/<mail_id>/tags', methods=['POST'])
def mail_tags(mail_id):
- mail = converter.from_mail(mail_service.mail(mail_id))
- return respond_json(mail['tags'])
+ new_tags = request.get_json()['newtags']
+ mail = mail_service.mail(mail_id)
+ mail_service.update_tags(mail, new_tags)
+ tag_names = [tag.name for tag in mail.tags]
+ return respond_json(tag_names)
@app.route('/mail/<mail_id>/read', methods=['POST'])