Merge pull request #5927 from FinnStutzenstein/pointOfOrderOnlyCanSpeak

Point of order only for agenda.can_be_speaker
This commit is contained in:
Emanuel Schütze 2021-03-01 16:12:44 +01:00 committed by GitHub
commit 83ff7b938c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -177,21 +177,19 @@
</form>
</div>
<div class="add-self-buttons">
<div class="add-self-buttons" *osPerms="'agenda.can_be_speaker'">
<!-- Add me and remove me if OP has correct permission -->
<button
*osPerms="'agenda.can_be_speaker'; and: !isOpInWaitlist()"
*ngIf="!isOpInWaitlist()"
mat-stroked-button
[disabled]="closed || !canAddSelf"
[disabled]="closed || !canAddDueToPresence"
(click)="addUserAsNewSpeaker()"
>
<mat-icon>add</mat-icon>
<span>{{ 'Add me' | translate }}</span>
</button>
<button
*osPerms="'agenda.can_be_speaker'; and: isOpInWaitlist()"
*ngIf="isOpInWaitlist()"
mat-stroked-button
[disabled]="closed"
(click)="removeSpeaker()"

View File

@ -58,7 +58,11 @@ export class ListOfSpeakersContentComponent extends BaseViewComponentDirective i
public showFistContributionHint: boolean;
public showPointOfOrders: boolean;
public get showPointOfOrders(): boolean {
return this.pointOfOrderEnabled && this.canAddDueToPresence;
}
private pointOfOrderEnabled: boolean;
public get title(): string {
return this.viewListOfSpeakers?.getTitle();
@ -72,7 +76,7 @@ export class ListOfSpeakersContentComponent extends BaseViewComponentDirective i
return this.operator.hasPerms(this.permission.agendaCanManageListOfSpeakers);
}
public get canAddSelf(): boolean {
public get canAddDueToPresence(): boolean {
return !this.config.instant('agenda_present_speakers_only') || this.operator.user.is_present;
}
@ -144,8 +148,8 @@ export class ListOfSpeakersContentComponent extends BaseViewComponentDirective i
this.showFistContributionHint = show;
}),
// observe point of order settings
this.config.get<boolean>('agenda_enable_point_of_order_speakers').subscribe(show => {
this.showPointOfOrders = show;
this.config.get<boolean>('agenda_enable_point_of_order_speakers').subscribe(enabled => {
this.pointOfOrderEnabled = enabled;
})
);
}

View File

@ -338,10 +338,9 @@ class ListOfSpeakersViewSet(
# Check permissions and other conditions. Get user instance.
if user_id is None:
# Add oneself
if not point_of_order and not has_perm(
self.request.user, "agenda.can_be_speaker"
):
if not has_perm(self.request.user, "agenda.can_be_speaker"):
self.permission_denied(request)
# even if the list is closed, point of order has to be accepted
if not point_of_order and list_of_speakers.closed:
raise ValidationError({"detail": "The list of speakers is closed."})