From 95213b6d85215be164649f3976a76534823bd72a Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sat, 16 May 2020 12:54:48 +0200 Subject: [PATCH] Add alias.disable_pgp column --- app/models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/models.py b/app/models.py index b54b1d2c..4ac37205 100644 --- a/app/models.py +++ b/app/models.py @@ -654,6 +654,12 @@ class Alias(db.Model, ModelMixin): # To have the list of all mailboxes, should use AliasInfo instead _mailboxes = db.relationship("Mailbox", secondary="alias_mailbox", lazy="joined") + # If the mailbox has PGP-enabled, user can choose disable the PGP on the alias + # this is useful when some senders already support PGP + disable_pgp = db.Column( + db.Boolean, nullable=False, default=False, server_default="0" + ) + user = db.relationship(User) mailbox = db.relationship("Mailbox", lazy="joined") @@ -665,6 +671,13 @@ class Alias(db.Model, ModelMixin): return ret + def mailbox_support_pgp(self) -> bool: + """return True of one of the mailboxes support PGP""" + for mb in self.mailboxes: + if mb.pgp_finger_print: + return True + return False + @classmethod def create(cls, **kw): r = cls(**kw)