summaryrefslogtreecommitdiff
path: root/service/pixelated/resources/mails_resource.py
diff options
context:
space:
mode:
authorRafael Lisboa <rafaelzlisboa@gmail.com>2015-04-27 12:35:02 -0300
committerRafael Lisboa <rafaelzlisboa@gmail.com>2015-04-27 12:35:02 -0300
commit9234ef399cac44dcdc8dab11c20dd162953e447c (patch)
treebbc3c618a245b903f99c1c41fa726062ead55ebf /service/pixelated/resources/mails_resource.py
parent5cc53a2ac0b47a05423ed9e4a64e24a3a9994a58 (diff)
parent6617b24ae00490cf86282147b732cfa31de127fb (diff)
Merge pull request #373 from roberto/master
Allow user to move emails from trash to inbox
Diffstat (limited to 'service/pixelated/resources/mails_resource.py')
-rw-r--r--service/pixelated/resources/mails_resource.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/service/pixelated/resources/mails_resource.py b/service/pixelated/resources/mails_resource.py
index c057031a..3822abd3 100644
--- a/service/pixelated/resources/mails_resource.py
+++ b/service/pixelated/resources/mails_resource.py
@@ -53,6 +53,20 @@ class MailsDeleteResource(Resource):
return respond_json(None, request)
+class MailsRecoverResource(Resource):
+ isLeaf = True
+
+ def __init__(self, mail_service):
+ Resource.__init__(self)
+ self._mail_service = mail_service
+
+ def render_POST(self, request):
+ idents = json.loads(request.content.read())['idents']
+ for ident in idents:
+ self._mail_service.recover_mail(ident)
+ return respond_json(None, request)
+
+
class MailsResource(Resource):
def _register_smtp_error_handler(self):
@@ -66,6 +80,7 @@ class MailsResource(Resource):
def __init__(self, mail_service, draft_service):
Resource.__init__(self)
self.putChild('delete', MailsDeleteResource(mail_service))
+ self.putChild('recover', MailsRecoverResource(mail_service))
self.putChild('read', MailsReadResource(mail_service))
self.putChild('unread', MailsUnreadResource(mail_service))