diff --git a/cookbook/helper/permission_helper.py b/cookbook/helper/permission_helper.py index 2e6df0bb4..6afb2e923 100644 --- a/cookbook/helper/permission_helper.py +++ b/cookbook/helper/permission_helper.py @@ -123,7 +123,7 @@ def share_link_valid(recipe, share): return c if link := ShareLink.objects.filter(recipe=recipe, uuid=share, abuse_blocked=False).first(): - if 0 < settings.SHARING_LIMIT < link.request_count: + if 0 < settings.SHARING_LIMIT < link.request_count and not link.space.no_sharing_limit: return False link.request_count += 1 link.save() diff --git a/cookbook/migrations/0188_space_no_sharing_limit.py b/cookbook/migrations/0188_space_no_sharing_limit.py new file mode 100644 index 000000000..5f7dce192 --- /dev/null +++ b/cookbook/migrations/0188_space_no_sharing_limit.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.4 on 2023-02-12 16:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cookbook', '0187_alter_space_use_plural'), + ] + + operations = [ + migrations.AddField( + model_name='space', + name='no_sharing_limit', + field=models.BooleanField(default=False), + ), + ] diff --git a/cookbook/models.py b/cookbook/models.py index 9ceb09a50..fa5b146d7 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -262,6 +262,7 @@ class Space(ExportModelOperationsMixin('space'), models.Model): max_users = models.IntegerField(default=0) use_plural = models.BooleanField(default=True) allow_sharing = models.BooleanField(default=True) + no_sharing_limit = models.BooleanField(default=False) demo = models.BooleanField(default=False) food_inherit = models.ManyToManyField(FoodInheritField, blank=True) show_facet_count = models.BooleanField(default=False)