Add User.ignore_loop_email column

This commit is contained in:
Son Nguyen Kim 2021-09-10 18:14:51 +02:00
parent f53e8c1af8
commit 62044e6db1
2 changed files with 35 additions and 0 deletions

View File

@ -336,6 +336,12 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle):
db.Boolean, default=False, nullable=False, server_default="0"
)
# ignore emails send from a mailbox to its alias. This can happen when replying all to a forwarded email
# can automatically re-includes the alias
ignore_loop_email = db.Column(
db.Boolean, default=False, nullable=False, server_default="0"
)
@classmethod
def create(cls, email, name="", password=None, **kwargs):
user: User = super(User, cls).create(email=email, name=name, **kwargs)

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: 4d3f91ddf3e9
Revises: 916a5257d18c
Create Date: 2021-09-10 18:12:21.374836
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4d3f91ddf3e9'
down_revision = '916a5257d18c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('ignore_loop_email', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'ignore_loop_email')
# ### end Alembic commands ###