diff --git a/froide/account/migrations/0037_accountblocklist_full_name.py b/froide/account/migrations/0037_accountblocklist_full_name.py new file mode 100644 index 000000000..f988e1e92 --- /dev/null +++ b/froide/account/migrations/0037_accountblocklist_full_name.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.14 on 2024-08-15 16:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("account", "0036_alter_application_user_alter_user_email_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="accountblocklist", + name="full_name", + field=models.TextField(blank=True), + ), + ] diff --git a/froide/account/models.py b/froide/account/models.py index 7433a3313..345090251 100644 --- a/froide/account/models.py +++ b/froide/account/models.py @@ -400,6 +400,7 @@ class AccountBlocklist(models.Model): address = models.TextField(blank=True) email = models.TextField(blank=True) + full_name = models.TextField(blank=True) objects = AccountBlocklistManager() @@ -411,7 +412,11 @@ def __str__(self): return self.name def match_user(self, user: User) -> bool: - return self.match_field(user, "address") or self.match_field(user, "email") + return ( + self.match_field(user, "address") + or self.match_field(user, "email") + or self.match_content(self.full_name, user.get_full_name()) + ) def match_field(self, user: User, key: str) -> bool: content = getattr(self, key)