diff --git a/openslides/core/serializers.py b/openslides/core/serializers.py index 71f154842..fd72cdb36 100644 --- a/openslides/core/serializers.py +++ b/openslides/core/serializers.py @@ -80,7 +80,8 @@ class ProjectorMessageSerializer(ModelSerializer): fields = ('id', 'message', ) def validate(self, data): - data['message'] = validate_html(data.get('message', '')) + if 'message' in data: + data['message'] = validate_html(data['message']) return data diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index ef7b90a27..1dabd9a05 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -259,7 +259,8 @@ class MotionChangeRecommendationSerializer(ModelSerializer): 'creation_time',) def validate(self, data): - data['text'] = validate_html(data.get('text', '')) + if 'text' in data: + data['text'] = validate_html(data['text']) return data @@ -311,8 +312,10 @@ class MotionSerializer(ModelSerializer): read_only_fields = ('state', 'recommendation',) # Some other fields are also read_only. See definitions above. def validate(self, data): - data['text'] = validate_html(data.get('text', '')) - data['reason'] = validate_html(data.get('reason', '')) + if 'text'in data: + data['text'] = validate_html(data['text']) + if 'reason' in data: + data['reason'] = validate_html(data['reason']) validated_comments = [] for comment in data.get('comments', []): validated_comments.append(validate_html(comment)) diff --git a/openslides/motions/static/js/motions/motion-services.js b/openslides/motions/static/js/motions/motion-services.js index fe73bbffb..b533dad92 100644 --- a/openslides/motions/static/js/motions/motion-services.js +++ b/openslides/motions/static/js/motions/motion-services.js @@ -187,9 +187,6 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions', return motion['comment ' + field.name]; }, function (obj) { - motion.title = motion.getTitle(-1); - motion.text = motion.getText(-1); - motion.reason = motion.getReason(-1); motion['comment ' + field.name] = obj.editor.getData(); } ); diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 0f238559f..115479679 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -844,13 +844,8 @@ angular.module('OpenSlidesApp.motions.site', [ return _.indexOf(motion.tags_id, tag.id) > -1; }; - // Use this methon instead of Motion.save(), because otherwise - // you have to provide always a title and a text $scope.save = function (motion) { - motion.title = motion.getTitle(-1); - motion.text = motion.getText(-1); - motion.reason = motion.getReason(-1); - Motion.save(motion); + Motion.save(motion, {method: 'PATCH'}); }; // delete single motion $scope.delete = function (motion) { @@ -1134,10 +1129,7 @@ angular.module('OpenSlidesApp.motions.site', [ ngDialog.open(MotionForm.getDialog(motion)); }; $scope.save = function (motion) { - motion.title = motion.getTitle(-1); - motion.text = motion.getText(-1); - motion.reason = motion.getReason(-1); - Motion.save(motion); + Motion.save(motion, {method: 'PATCH'}); }; // support $scope.support = function () { diff --git a/openslides/topics/serializers.py b/openslides/topics/serializers.py index bd774c679..f948033fb 100644 --- a/openslides/topics/serializers.py +++ b/openslides/topics/serializers.py @@ -13,5 +13,6 @@ class TopicSerializer(ModelSerializer): fields = ('id', 'title', 'text', 'attachments', 'agenda_item_id') def validate(self, data): - data['text'] = validate_html(data.get('text', '')) + if 'text' in data: + data['text'] = validate_html(['text']) return data