Merge pull request #3127 from emanuelschuetze/issue3112

Use a whitelist for getFormOrStateForCurrentSlide (fixes #3112, #3038)
This commit is contained in:
Emanuel Schütze 2017-03-22 15:54:38 +01:00 committed by GitHub
commit e5028f7ef2
8 changed files with 26 additions and 16 deletions

View File

@ -819,11 +819,15 @@ angular.module('OpenSlidesApp.core', [
id: value.id,
};
} else if (
value.name != 'agenda/item-list' &&
value.name != 'core/clock' &&
value.name != 'core/countdown' &&
value.name != 'core/projector-message' &&
value.name != 'agenda/current-list-of-speakers' ) {
// TODO:
// Find generic solution for whitelist in getFormOrStateForCurrentSlide
// see https://github.com/OpenSlides/OpenSlides/issues/3130
value.name === 'topics/topic' ||
value.name === 'motions/motion' ||
value.name === 'motions/motion-block' ||
value.name === 'assignments/assignment' ||
value.name === 'mediafiles/mediafile' ||
value.name === 'users/user') {
return_dict = {
form: EditForm.fromCollectionString(value.name),
id: value.id,

View File

@ -771,6 +771,12 @@ angular.module('OpenSlidesApp.core.site', [
encoding: $scope.encoding,
header: false, // we do not want to have dicts in result
complete: function (csv) {
if (csv.data.length) {
csv.meta.fields = csv.data[0];
}
else {
csv.meta.fields = [];
}
csv.data = csv.data.splice(1); // do not interpret the header as data
$scope.$apply(function () {
if (csv.meta.delimiter) {

View File

@ -39,7 +39,7 @@ class MotionsAppConfig(AppConfig):
router.register(self.get_model('Workflow').get_collection_string(), WorkflowViewSet)
router.register(self.get_model('MotionChangeRecommendation').get_collection_string(),
MotionChangeRecommendationViewSet)
router.register('motions/motionpoll', MotionPollViewSet)
router.register(self.get_model('MotionPoll').get_collection_string(), MotionPollViewSet)
def get_startup_elements(self):
"""

View File

@ -69,7 +69,7 @@ angular.module('OpenSlidesApp.motions', [
'MajorityMethods',
function (DS, gettextCatalog, Config, MajorityMethods) {
return DS.defineResource({
name: 'motions/motionpoll',
name: 'motions/motion-poll',
relations: {
belongsTo: {
'motions/motion': {
@ -629,7 +629,7 @@ angular.module('OpenSlidesApp.motions', [
localKeys: 'supporters_id',
}
],
'motions/motionpoll': {
'motions/motion-poll': {
localField: 'polls',
foreignKey: 'motion_id',
}

View File

@ -588,7 +588,7 @@ angular.module('OpenSlidesApp.motions.site', [
key: 'votesvalid',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Valid ballots'),
label: gettextCatalog.getString('Valid votes'),
type: 'number'
}
},
@ -596,7 +596,7 @@ angular.module('OpenSlidesApp.motions.site', [
key: 'votesinvalid',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Invalid ballots'),
label: gettextCatalog.getString('Invalid votes'),
type: 'number'
}
},
@ -604,7 +604,7 @@ angular.module('OpenSlidesApp.motions.site', [
key: 'votescast',
type: 'input',
templateOptions: {
label: gettextCatalog.getString('Casted ballots'),
label: gettextCatalog.getString('Votes cast'),
type: 'number'
}
}];
@ -1224,7 +1224,7 @@ angular.module('OpenSlidesApp.motions.site', [
// open poll update dialog
$scope.openPollDialog = function (poll, voteNumber) {
ngDialog.open({
template: 'static/templates/motions/motionpoll-form.html',
template: 'static/templates/motions/motion-poll-form.html',
controller: 'MotionPollUpdateCtrl',
className: 'ngdialog-theme-default',
closeByEscape: false,

View File

@ -362,7 +362,7 @@
<td class="icon">
<i class="fa fa-check fa-lg"></i>
<td ng-init="votesValid = poll.getVote(poll.votesvalid, 'votesvalid')">
<span class="result_label"><translate>Valid ballots</translate>:</span>
<span class="result_label"><translate>Valid votes</translate>:</span>
<span class="result_value">
{{ votesValid.value }} {{ votesValid.percentStr }}
</span>
@ -371,7 +371,7 @@
<td class="icon">
<i class="fa fa-ban fa-lg"></i>
<td ng-init="votesInvalid = poll.getVote(poll.votesinvalid, 'votesinvalid')">
<span class="result_label"><translate>Invalid ballots</translate>:</span>
<span class="result_label"><translate>Invalid votes</translate>:</span>
<span class="result_value">
{{ votesInvalid.value }} {{ votesInvalid.percentStr }}
</span>
@ -380,7 +380,7 @@
<td class="icon">
<strong style="font-size: 16px">&sum;</strong>
<td ng-init="votesCast = poll.getVote(poll.votescast, 'votescast')">
<span class="result_label"><translate>Casted ballots</translate>:</span>
<span class="result_label"><translate>Votes cast</translate>:</span>
<span class="result_value">
{{ votesCast.value }} {{ votesCast.percentStr }}
</span>

View File

@ -399,8 +399,8 @@ class MotionPollViewSet(UpdateModelMixin, DestroyModelMixin, GenericViewSet):
"""
Customized view endpoint to delete a motion poll.
"""
result = super().destroy(*args, **kwargs)
poll = self.get_object()
result = super().destroy(*args, **kwargs)
poll.motion.write_log([ugettext_noop('Vote deleted')], self.request.user)
return result