diff --git a/app/models.py b/app/models.py index d2c09832..ceae4a4a 100644 --- a/app/models.py +++ b/app/models.py @@ -1929,7 +1929,6 @@ class PostReply(db.Model): return undo - class Domain(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255), index=True) @@ -1937,6 +1936,7 @@ class Domain(db.Model): banned = db.Column(db.Boolean, default=False, index=True) # Domains can be banned site-wide (by admin) or DomainBlock'ed by users notify_mods = db.Column(db.Boolean, default=False, index=True) notify_admins = db.Column(db.Boolean, default=False, index=True) + post_warning = db.Column(db.String(512)) def blocked_by(self, user): block = DomainBlock.query.filter_by(domain_id=self.id, user_id=user.id).first() diff --git a/app/templates/post/_post_full.html b/app/templates/post/_post_full.html index 79e2fe1e..9ae42048 100644 --- a/app/templates/post/_post_full.html +++ b/app/templates/post/_post_full.html @@ -41,7 +41,10 @@ {% elif post.type == POST_TYPE_LINK -%}
+ + {% if post.domain.post_warning -%} + + {% endif -%} {% if post.url.endswith('.mp3') -%} {% elif post.url.endswith('.mp4') or post.url.endswith('.webm') -%} diff --git a/app/templates/post/post_teaser/_title.html b/app/templates/post/post_teaser/_title.html index a0e5a95a..41606ba4 100644 --- a/app/templates/post/post_teaser/_title.html +++ b/app/templates/post/post_teaser/_title.html @@ -9,7 +9,11 @@ {% if post.type == POST_TYPE_VIDEO -%} {% endif -%} - + {% endif -%} {% if post.nsfw -%}nsfw{% endif -%} {% if post.nsfl -%}nsfl{% endif -%} diff --git a/migrations/versions/1189f921aca6_domain_post_warning.py b/migrations/versions/1189f921aca6_domain_post_warning.py new file mode 100644 index 00000000..c35c39e7 --- /dev/null +++ b/migrations/versions/1189f921aca6_domain_post_warning.py @@ -0,0 +1,32 @@ +"""domain post warning + +Revision ID: 1189f921aca6 +Revises: f2fa25ab5e52 +Create Date: 2024-12-13 19:17:15.319197 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '1189f921aca6' +down_revision = 'f2fa25ab5e52' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('domain', schema=None) as batch_op: + batch_op.add_column(sa.Column('post_warning', sa.String(length=512), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('domain', schema=None) as batch_op: + batch_op.drop_column('post_warning') + + # ### end Alembic commands ###