From c8b4d5ecf122ca1f44996e5db311cdc2e873738d Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 17 Feb 2022 21:01:34 -0800 Subject: [PATCH] Adds model for creating automated moderation flags --- bookwyrm/migrations/0138_autoflag.py | 26 ++++++++++++++++++++++++++ bookwyrm/models/antispam.py | 8 ++++++++ 2 files changed, 34 insertions(+) create mode 100644 bookwyrm/migrations/0138_autoflag.py diff --git a/bookwyrm/migrations/0138_autoflag.py b/bookwyrm/migrations/0138_autoflag.py new file mode 100644 index 00000000..b1e803d4 --- /dev/null +++ b/bookwyrm/migrations/0138_autoflag.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.12 on 2022-02-18 04:53 + +from django.conf import settings +import django.contrib.postgres.fields +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0137_alter_sitesettings_allow_registration'), + ] + + operations = [ + migrations.CreateModel( + name='AutoFlag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('flag_users', models.BooleanField(default=False)), + ('flag_statuses', models.BooleanField(default=False)), + ('string_match', models.CharField(max_length=200)), + ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/bookwyrm/models/antispam.py b/bookwyrm/models/antispam.py index 7a85bbcf..98587a47 100644 --- a/bookwyrm/models/antispam.py +++ b/bookwyrm/models/antispam.py @@ -33,3 +33,11 @@ class IPBlocklist(models.Model): """default sorting""" ordering = ("-created_date",) + + +class AutoFlag(models.Model): + """rules to automatically flag suspicious activity""" + created_by = models.ForeignKey("User", on_delete=models.PROTECT) + flag_users = models.BooleanField(default=False) + flag_statuses = models.BooleanField(default=False) + string_match = models.CharField(max_length=200)