Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"string[]": "CharArrayField",
"number[]": "NumberArrayField",
"text": "TextField",
"text[]": "TextArrayField",
}

RELATION_FIELD_CLASSES = {
Expand Down
2 changes: 1 addition & 1 deletion meta
Submodule meta updated 2 files
+1 −0 dev/src/validate.py
+1 −1 models.yml
2 changes: 2 additions & 0 deletions openslides_backend/models/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
NumberArrayField,
RelationField,
RelationListField,
TextArrayField,
TextField,
TimestampField,
)
Expand Down Expand Up @@ -141,6 +142,7 @@ def check_json(value: Any, root: bool = True) -> bool:
FloatField: check_float,
BooleanField: check_boolean,
CharArrayField: check_string_list,
TextArrayField: check_string_list,
GenericRelationListField: check_string_list,
NumberArrayField: check_number_list,
RelationListField: check_number_list,
Expand Down
8 changes: 8 additions & 0 deletions openslides_backend/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ def get_schema(self) -> Schema:
return self.extend_schema(super().get_schema(), type=["array", "null"])


class TextArrayField(ArrayField):
def get_schema(self) -> Schema:
items = dict(type="string")
if self.in_array_constraints is not None:
items.update(self.in_array_constraints)
return self.extend_schema(super().get_schema(), items=items)


class CharArrayField(ArrayField):
def get_schema(self) -> Schema:
items = dict(type="string", maxLength=256)
Expand Down
2 changes: 1 addition & 1 deletion openslides_backend/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ class HistoryEntry(Model):
verbose_name = "history entry"

id = fields.IntegerField(required=True, constant=True)
entries = fields.CharArrayField()
entries = fields.TextArrayField()
original_model_id = fields.CharField(constant=True)
model_id = fields.GenericRelationField(
to={
Expand Down
11 changes: 11 additions & 0 deletions tests/system/action/user/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4671,6 +4671,17 @@ def test_update_with_home_committee_as_multi_committee_admin_group_F(self) -> No
response.json["message"],
)

def test_multi_delegation_doesnt_break_history(self) -> None:
self.create_meeting(1)
self.set_user_groups(1, [2])
for i in range(2, 68):
self.create_user(f"user{i}", group_ids=[3])
response = self.request(
"user.update",
{"id": 1, "meeting_id": 1, "vote_delegations_from_ids": list(range(2, 68))},
)
self.assert_status_code(response, 200)


class UserUpdateHomeCommitteePermissionTest(BaseActionTestCase):
committeePerms: set[int] = set()
Expand Down