Browse Source

add User.use_via_format_for_sender column

Son NK 5 years ago
parent
commit
65ca7d2a71
2 changed files with 35 additions and 0 deletions
  1. 6 0
      app/models.py
  2. 29 0
      migrations/versions/2020_032822_224fd8963462_.py

+ 6 - 0
app/models.py

@@ -148,6 +148,12 @@ class User(db.Model, ModelMixin, UserMixin):
 
     profile_picture = db.relationship(File, foreign_keys=[profile_picture_id])
 
+    # Use the "via" format for sender address, i.e. "name@example.com via SimpleLogin"
+    # If False, use the format "Name - name at example.com"
+    use_via_format_for_sender = db.Column(
+        db.Boolean, default=True, nullable=False, server_default="1"
+    )
+
     @classmethod
     def create(cls, email, name, password=None, **kwargs):
         user: User = super(User, cls).create(email=email, name=name, **kwargs)

+ 29 - 0
migrations/versions/2020_032822_224fd8963462_.py

@@ -0,0 +1,29 @@
+"""empty message
+
+Revision ID: 224fd8963462
+Revises: 67c61eead8d2
+Create Date: 2020-03-28 22:30:19.428692
+
+"""
+import sqlalchemy_utils
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '224fd8963462'
+down_revision = '67c61eead8d2'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('users', sa.Column('use_via_format_for_sender', sa.Boolean(), server_default='1', nullable=False))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('users', 'use_via_format_for_sender')
+    # ### end Alembic commands ###