summaryrefslogtreecommitdiff
path: root/service/pixelated/user_agent.py
diff options
context:
space:
mode:
authorPatrick Maia <pmaia@thoughtworks.com>2014-09-15 12:13:52 -0300
committerPatrick Maia <pmaia@thoughtworks.com>2014-09-15 12:13:52 -0300
commit752ebe6d3709b543cde758726ec72683894956f0 (patch)
tree85fc7379c54b723a65e9456aafcfe76702c1c0a7 /service/pixelated/user_agent.py
parent6079196a9237ff1ae77ffb2bbc66f8bdc8698711 (diff)
adding feature toggle for drafts
Diffstat (limited to 'service/pixelated/user_agent.py')
-rw-r--r--service/pixelated/user_agent.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py
index 952af297..19c5c3f5 100644
--- a/service/pixelated/user_agent.py
+++ b/service/pixelated/user_agent.py
@@ -49,24 +49,23 @@ def respond_json(entity):
response = json.dumps(entity)
return Response(response=response, mimetype="application/json")
+DISABLED_FEATURES = ['saveDraft', 'draftReply', 'signatureStatus', 'encryptionStatus', 'contacts']
@app.route('/disabled_features')
def disabled_features():
- return respond_json([
- 'draftReply',
- 'signatureStatus',
- 'encryptionStatus',
- 'contacts'
- ])
+ return respond_json(DISABLED_FEATURES)
@app.route('/mails', methods=['POST'])
def send_mail():
_mail = PixelatedMail.from_dict(request.json)
- if _mail.ident:
- mail_service.send_draft(_mail)
+ if 'saveDrafts' in DISABLED_FEATURES:
+ mail_service.send(_mail)
else:
- _mail = mail_service.create_draft(_mail)
+ if _mail.ident:
+ mail_service.send_draft(_mail)
+ else:
+ _mail = mail_service.create_draft(_mail)
return respond_json(_mail.as_dict())