Merge pull request #4459 from FinnStutzenstein/fixUpdatingMotions

set allow_null for integerfields, when they are not required
This commit is contained in:
Emanuel Schütze 2019-03-05 15:02:26 +01:00 committed by GitHub
commit 1fecf941c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -109,6 +109,7 @@ export class LocalPermissionsService {
motion.state.allow_submitter_edit && motion.state.allow_submitter_edit &&
motion.submitters && motion.submitters &&
motion.submitters.length && motion.submitters.length &&
!this.operator.isAnonymous &&
motion.submitters.some(submitter => submitter.id === this.operator.user.id)) motion.submitters.some(submitter => submitter.id === this.operator.user.id))
); );
} }
@ -139,6 +140,7 @@ export class LocalPermissionsService {
this.operator.hasPerms('motions.can_manage_metadata') || this.operator.hasPerms('motions.can_manage_metadata') ||
(motion.state && (motion.state &&
motion.state.allow_submitter_edit && motion.state.allow_submitter_edit &&
!this.operator.isAnonymous &&
motion.submitters && motion.submitters &&
motion.submitters.some(submitter => submitter.id === this.operator.user.id)) motion.submitters.some(submitter => submitter.id === this.operator.user.id))
); );

View File

@ -68,7 +68,7 @@ class MotionBlockSerializer(ModelSerializer):
""" """
agenda_type = IntegerField( agenda_type = IntegerField(
write_only=True, required=False, min_value=1, max_value=3 write_only=True, required=False, min_value=1, max_value=3, allow_null=True
) )
agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1) agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1)
@ -397,7 +397,7 @@ class MotionSerializer(ModelSerializer):
min_value=1, required=False, validators=[validate_workflow_field] min_value=1, required=False, validators=[validate_workflow_field]
) )
agenda_type = IntegerField( agenda_type = IntegerField(
write_only=True, required=False, min_value=1, max_value=3 write_only=True, required=False, min_value=1, max_value=3, allow_null=True
) )
agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1) agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1)
submitters = SubmitterSerializer(many=True, read_only=True) submitters = SubmitterSerializer(many=True, read_only=True)

View File

@ -11,7 +11,7 @@ class TopicSerializer(ModelSerializer):
""" """
agenda_type = IntegerField( agenda_type = IntegerField(
write_only=True, required=False, min_value=1, max_value=3 write_only=True, required=False, min_value=1, max_value=3, allow_null=True
) )
agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1) agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1)
agenda_comment = CharField(write_only=True, required=False, allow_blank=True) agenda_comment = CharField(write_only=True, required=False, allow_blank=True)