Merge pull request #2367 from emanuelschuetze/motionCommentFixes
Fixes and template improvements for motion comments.
This commit is contained in:
commit
ddc1f5d0b9
@ -591,6 +591,8 @@ class Motion(RESTModelMixin, models.Model):
|
|||||||
The message should be in English and translatable,
|
The message should be in English and translatable,
|
||||||
e. g. motion.write_log(message_list=[ugettext_noop('Message Text')])
|
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)
|
MotionLog.objects.create(motion=self, message_list=message_list, person=person)
|
||||||
|
|
||||||
def is_amendment(self):
|
def is_amendment(self):
|
||||||
|
@ -290,7 +290,7 @@ class MotionSerializer(ModelSerializer):
|
|||||||
motion.save()
|
motion.save()
|
||||||
if validated_data.get('submitters'):
|
if validated_data.get('submitters'):
|
||||||
motion.submitters.add(*validated_data['submitters'])
|
motion.submitters.add(*validated_data['submitters'])
|
||||||
else:
|
elif validated_data['request_user'].is_authenticated():
|
||||||
motion.submitters.add(validated_data['request_user'])
|
motion.submitters.add(validated_data['request_user'])
|
||||||
motion.supporters.add(*validated_data.get('supporters', []))
|
motion.supporters.add(*validated_data.get('supporters', []))
|
||||||
motion.attachments.add(*validated_data.get('attachments', []))
|
motion.attachments.add(*validated_data.get('attachments', []))
|
||||||
|
@ -1209,6 +1209,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
|
|||||||
'$state',
|
'$state',
|
||||||
'gettext',
|
'gettext',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
|
'operator',
|
||||||
'Motion',
|
'Motion',
|
||||||
'MotionForm',
|
'MotionForm',
|
||||||
'Category',
|
'Category',
|
||||||
@ -1219,7 +1220,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
|
|||||||
'Workflow',
|
'Workflow',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'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');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -1252,11 +1253,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions', 'OpenSlid
|
|||||||
$scope.save = function (motion) {
|
$scope.save = function (motion) {
|
||||||
Motion.create(motion).then(
|
Motion.create(motion).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
|
// 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,
|
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
|
||||||
// see openslides.agenda.models.Item.ITEM_TYPE.
|
// see openslides.agenda.models.Item.ITEM_TYPE.
|
||||||
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
||||||
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
||||||
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
||||||
|
}
|
||||||
if (isAmendment) {
|
if (isAmendment) {
|
||||||
$state.go('motions.motion.detail', {id: success.id});
|
$state.go('motions.motion.detail', {id: success.id});
|
||||||
}
|
}
|
||||||
|
@ -398,11 +398,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="details">
|
<div class="details" ng-if="motion.comments">
|
||||||
<h3>Motion Comments</h3>
|
<h3>Motion Comments</h3>
|
||||||
<div ng-repeat="field in commentsFields">
|
<div ng-repeat="field in commentsFields">
|
||||||
<p ng-if="field.public || operator.hasPerms('motions.can_see_and_manage_comments')">
|
<p ng-if="field.public || operator.hasPerms('motions.can_see_and_manage_comments')">
|
||||||
{{ field.name }}: {{ motion.comments[$index] }}
|
<b>{{ field.name }}:</b>
|
||||||
|
<span ng-if="!field.public" class="label label-warning" translate>internal</span>
|
||||||
|
<br>
|
||||||
|
{{ motion.comments[$index] }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1311,6 +1311,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
gettext('Can create motions');
|
gettext('Can create motions');
|
||||||
gettext('Can support motions');
|
gettext('Can support motions');
|
||||||
gettext('Can manage motions');
|
gettext('Can manage motions');
|
||||||
|
gettext('Can see and manage comments');
|
||||||
// users
|
// users
|
||||||
gettext('Can see names of users');
|
gettext('Can see names of users');
|
||||||
gettext('Can see extra data of users (e.g. present and comment)');
|
gettext('Can see extra data of users (e.g. present and comment)');
|
||||||
|
Loading…
Reference in New Issue
Block a user