allow infiinit sharing as space setting
This commit is contained in:
@ -123,7 +123,7 @@ def share_link_valid(recipe, share):
|
|||||||
return c
|
return c
|
||||||
|
|
||||||
if link := ShareLink.objects.filter(recipe=recipe, uuid=share, abuse_blocked=False).first():
|
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
|
return False
|
||||||
link.request_count += 1
|
link.request_count += 1
|
||||||
link.save()
|
link.save()
|
||||||
|
18
cookbook/migrations/0188_space_no_sharing_limit.py
Normal file
18
cookbook/migrations/0188_space_no_sharing_limit.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
@ -262,6 +262,7 @@ class Space(ExportModelOperationsMixin('space'), models.Model):
|
|||||||
max_users = models.IntegerField(default=0)
|
max_users = models.IntegerField(default=0)
|
||||||
use_plural = models.BooleanField(default=True)
|
use_plural = models.BooleanField(default=True)
|
||||||
allow_sharing = models.BooleanField(default=True)
|
allow_sharing = models.BooleanField(default=True)
|
||||||
|
no_sharing_limit = models.BooleanField(default=False)
|
||||||
demo = models.BooleanField(default=False)
|
demo = models.BooleanField(default=False)
|
||||||
food_inherit = models.ManyToManyField(FoodInheritField, blank=True)
|
food_inherit = models.ManyToManyField(FoodInheritField, blank=True)
|
||||||
show_facet_count = models.BooleanField(default=False)
|
show_facet_count = models.BooleanField(default=False)
|
||||||
|
Reference in New Issue
Block a user