Make configurable whether a newly created list of speakers is initially open or closed
This commit is contained in:
parent
4d706f648f
commit
a9d223121e
1
AUTHORS
1
AUTHORS
@ -33,3 +33,4 @@ Authors of OpenSlides in chronological order of first contribution:
|
||||
Joshua Sangmeister <joshua.sangmeister@gmail.com>
|
||||
Gernot Schulz <gernot@intevtion.de>
|
||||
Raphael Topel <info@rtopel.de>
|
||||
Martin Dickopp <martin@zero-based.org>
|
||||
|
@ -125,6 +125,7 @@ _('Enable points of order');
|
||||
_('[Begin speech] starts the countdown, [End speech] stops the countdown.');
|
||||
_('Only present participants can be added to the list of speakers');
|
||||
_('Show hint »first speech« in the list of speakers management view');
|
||||
_('List of speakers is initially closed');
|
||||
_('Default visibility for new agenda items (except topics)');
|
||||
_('public');
|
||||
_('internal');
|
||||
|
@ -210,3 +210,13 @@ def get_config_variables():
|
||||
group="Agenda",
|
||||
subgroup="List of speakers",
|
||||
)
|
||||
|
||||
yield ConfigVariable(
|
||||
name="agenda_list_of_speakers_initially_closed",
|
||||
default_value=False,
|
||||
input_type="boolean",
|
||||
label="List of speakers is initially closed",
|
||||
weight=235,
|
||||
group="Agenda",
|
||||
subgroup="List of speakers",
|
||||
)
|
||||
|
@ -0,0 +1,22 @@
|
||||
# Generated by Django 2.2.19 on 2021-03-08 14:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import openslides.agenda.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("agenda", "0010_speaker_point_of_order"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="listofspeakers",
|
||||
name="closed",
|
||||
field=models.BooleanField(
|
||||
default=openslides.agenda.models.list_of_speakers_initially_closed
|
||||
),
|
||||
),
|
||||
]
|
@ -360,6 +360,13 @@ class ListOfSpeakersManager(BaseManager):
|
||||
)
|
||||
|
||||
|
||||
def list_of_speakers_initially_closed():
|
||||
"""
|
||||
Return whether a newly created list of speakers is initially closed.
|
||||
"""
|
||||
return config["agenda_list_of_speakers_initially_closed"]
|
||||
|
||||
|
||||
class ListOfSpeakers(RESTModelMixin, models.Model):
|
||||
|
||||
access_permissions = ListOfSpeakersAccessPermissions()
|
||||
@ -383,7 +390,7 @@ class ListOfSpeakers(RESTModelMixin, models.Model):
|
||||
Field for generic relation to a related object. General field to the related object.
|
||||
"""
|
||||
|
||||
closed = models.BooleanField(default=False)
|
||||
closed = models.BooleanField(default=list_of_speakers_initially_closed)
|
||||
"""
|
||||
True, if the list of speakers is closed.
|
||||
"""
|
||||
|
@ -1,4 +1,5 @@
|
||||
from openslides.agenda.models import Item
|
||||
from openslides.core.config import config
|
||||
from openslides.topics.models import Topic
|
||||
from tests.test_case import TestCase
|
||||
|
||||
@ -13,3 +14,40 @@ class TestItemManager(TestCase):
|
||||
|
||||
with self.assertNumQueries(1):
|
||||
Item.objects.get_root_and_children()
|
||||
|
||||
|
||||
class TestListOfSpeakers(TestCase):
|
||||
def test_open_if_initial_state_configured_to_be_open(self):
|
||||
"""
|
||||
Test a newly created list of speakers is open if the
|
||||
agenda_list_of_speakers_initially_closed configuration variable has
|
||||
been set to False.
|
||||
"""
|
||||
config["agenda_list_of_speakers_initially_closed"] = False
|
||||
list_of_speakers = Topic.objects.create(
|
||||
title="list_of_speakers"
|
||||
).list_of_speakers
|
||||
self.assertFalse(list_of_speakers.closed)
|
||||
|
||||
def test_closed_if_initial_state_configured_to_be_closed(self):
|
||||
"""
|
||||
Test a newly created list of speakers is closed if the
|
||||
agenda_list_of_speakers_initially_closed configuration variable has
|
||||
been set to True.
|
||||
"""
|
||||
config["agenda_list_of_speakers_initially_closed"] = True
|
||||
list_of_speakers = Topic.objects.create(
|
||||
title="list_of_speakers"
|
||||
).list_of_speakers
|
||||
self.assertTrue(list_of_speakers.closed)
|
||||
|
||||
def test_open_if_initial_state_not_configured(self):
|
||||
"""
|
||||
Test a newly created list of speakers is open if the
|
||||
agenda_list_of_speakers_initially_closed configuration variable has
|
||||
not been set.
|
||||
"""
|
||||
list_of_speakers = Topic.objects.create(
|
||||
title="list_of_speakers"
|
||||
).list_of_speakers
|
||||
self.assertFalse(list_of_speakers.closed)
|
||||
|
Loading…
Reference in New Issue
Block a user