Add alias.disable_pgp column
This commit is contained in:
parent
083a857f1b
commit
95213b6d85
|
@ -654,6 +654,12 @@ class Alias(db.Model, ModelMixin):
|
||||||
# To have the list of all mailboxes, should use AliasInfo instead
|
# To have the list of all mailboxes, should use AliasInfo instead
|
||||||
_mailboxes = db.relationship("Mailbox", secondary="alias_mailbox", lazy="joined")
|
_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)
|
user = db.relationship(User)
|
||||||
mailbox = db.relationship("Mailbox", lazy="joined")
|
mailbox = db.relationship("Mailbox", lazy="joined")
|
||||||
|
|
||||||
|
@ -665,6 +671,13 @@ class Alias(db.Model, ModelMixin):
|
||||||
|
|
||||||
return ret
|
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
|
@classmethod
|
||||||
def create(cls, **kw):
|
def create(cls, **kw):
|
||||||
r = cls(**kw)
|
r = cls(**kw)
|
||||||
|
|
Loading…
Reference in a new issue