allow infiinit sharing as space setting

This commit is contained in:
vabene1111
2023-02-12 18:16:43 +01:00
parent cb363d6321
commit 3c527fd112
3 changed files with 20 additions and 1 deletions

View File

@ -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()

View File

@ -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),
),
]

View File

@ -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)