Merge pull request #2367 from emanuelschuetze/motionCommentFixes

Fixes and template improvements for motion comments.
This commit is contained in:
Norman Jäckel 2016-09-08 13:24:08 +02:00 committed by GitHub
commit ddc1f5d0b9
5 changed files with 24 additions and 14 deletions

View File

@ -591,6 +591,8 @@ class Motion(RESTModelMixin, models.Model):
The message should be in English and translatable,
e. g. motion.write_log(message_list=[ugettext_noop('Message Text')])
"""
if person and not person.is_authenticated():
person = None
MotionLog.objects.create(motion=self, message_list=message_list, person=person)
def is_amendment(self):

View File

@ -290,7 +290,7 @@ class MotionSerializer(ModelSerializer):
motion.save()
if validated_data.get('submitters'):
motion.submitters.add(*validated_data['submitters'])
else:
elif validated_data['request_user'].is_authenticated():
motion.submitters.add(validated_data['request_user'])
motion.supporters.add(*validated_data.get('supporters', []))
motion.attachments.add(*validated_data.get('attachments', []))

View File

@ -1209,6 +1209,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
'$state',
'gettext',
'gettextCatalog',
'operator',
'Motion',
'MotionForm',
'Category',
@ -1219,7 +1220,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
'Workflow',
'Agenda',
'AgendaUpdate',
function($scope, $state, gettext, gettextCatalog, Motion, MotionForm, Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate) {
function($scope, $state, gettext, gettextCatalog, operator, Motion, MotionForm, Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate) {
Category.bindAll({}, $scope, 'categories');
Mediafile.bindAll({}, $scope, 'mediafiles');
Tag.bindAll({}, $scope, 'tags');
@ -1252,11 +1253,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
$scope.save = function (motion) {
Motion.create(motion).then(
function(success) {
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
// see openslides.agenda.models.Item.ITEM_TYPE.
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
{key: 'parent_id', value: motion.agenda_parent_item_id}];
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
// change agenda item only if user has the permission to do that
if (operator.hasPerms('agenda.can_manage')) {
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
// see openslides.agenda.models.Item.ITEM_TYPE.
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
{key: 'parent_id', value: motion.agenda_parent_item_id}];
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
}
if (isAmendment) {
$state.go('motions.motion.detail', {id: success.id});
}

View File

@ -398,11 +398,14 @@
</div>
</div>
<div class="details">
<h3>Motion Comments</h3>
<div ng-repeat="field in commentsFields">
<p ng-if="field.public || operator.hasPerms('motions.can_see_and_manage_comments')">
{{ field.name }}: {{ motion.comments[$index] }}
</p>
</div>
<div class="details" ng-if="motion.comments">
<h3>Motion Comments</h3>
<div ng-repeat="field in commentsFields">
<p ng-if="field.public || operator.hasPerms('motions.can_see_and_manage_comments')">
<b>{{ field.name }}:</b>
<span ng-if="!field.public" class="label label-warning" translate>internal</span>
<br>
{{ motion.comments[$index] }}
</p>
</div>
</div>

View File

@ -1311,6 +1311,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
gettext('Can create motions');
gettext('Can support motions');
gettext('Can manage motions');
gettext('Can see and manage comments');
// users
gettext('Can see names of users');
gettext('Can see extra data of users (e.g. present and comment)');