Merge pull request #3159 from FinnStutzenstein/Issue3140
fixing validate_html and motion saving (fixes #3140)
This commit is contained in:
commit
9e96db894c
@ -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
|
||||
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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();
|
||||
}
|
||||
);
|
||||
|
@ -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 () {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user