Fix LOS (closes #6035)

This commit is contained in:
Finn Stutzenstein 2021-04-29 07:53:02 +02:00
parent d030925e14
commit 75bd3c50e5
No known key found for this signature in database
GPG Key ID: 9042F605C6324654
3 changed files with 12 additions and 5 deletions

View File

@ -141,7 +141,7 @@
*ngIf="speaker.point_of_order"
>warning</mat-icon
>
<i *ngIf="showSpeakersOrderNote" class="red-warning-text">
<i class="red-warning-text">
{{ speaker.note }}
</i>
</ng-container>

View File

@ -87,10 +87,6 @@ export class ListOfSpeakersContentComponent extends BaseViewComponentDirective i
return !this.config.instant('agenda_present_speakers_only') || this.operator.user.is_present;
}
public get showSpeakersOrderNote(): boolean {
return this.noteForAll || this.opCanManage;
}
@Input()
public set speakers(los: ViewListOfSpeakers) {
this.setListOfSpeakers(los);

View File

@ -574,6 +574,11 @@ class SpeakerViewSet(UpdateModelMixin, GenericViewSet):
):
raise ValidationError({"detail": "pro/contra speech is not enabled"})
if "pro_speech" in request.data and "marked" in request.data:
raise ValidationError(
{"detail": "pro_speech and marked cannot be given together"}
)
if not has_perm(request.user, "agenda.can_manage_list_of_speakers"):
# if no manage perms, only the speaker user itself can update the speaker.
speaker = self.get_object()
@ -590,4 +595,10 @@ class SpeakerViewSet(UpdateModelMixin, GenericViewSet):
{"detail": f"You are not allowed to set {key}"}
)
# toggle marked/pro_speech: If one is given, reset the other one
if request.data.get("pro_speech") in (True, False):
request.data["marked"] = False
if request.data.get("marked"):
request.data["pro_speech"] = None
return super().update(request, *args, **kwargs)