Merge pull request #5193 from tsiegleauq/final-version-without-reco

Allow final versions without change reco
This commit is contained in:
Emanuel Schütze 2020-01-30 09:31:36 +01:00 committed by GitHub
commit 2ac01a5ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 6 deletions

View File

@ -517,8 +517,7 @@
*ngIf="
motion &&
!motion.isParagraphBasedAmendment() &&
allChangingObjects &&
allChangingObjects.length > 0
((allChangingObjects && allChangingObjects.length) || motion.modified_final_version)
"
>
<mat-icon>rate_review</mat-icon>
@ -527,17 +526,18 @@
</div>
<!-- Final edit buttons -->
<div *ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) || isRecoMode(ChangeRecoMode.Final)">
<div *osPerms="'motions.can_manage'">
<!-- create final version -->
<button
type="button"
mat-icon-button
matTooltip="{{ 'Create final print template' | translate }}"
*osPerms="'motions.can_manage'; and: isRecoMode(ChangeRecoMode.Final)"
*ngIf="motion.state.isFinalState"
(click)="createModifiedFinalVersion()"
>
<mat-icon>file_copy</mat-icon>
</button>
<!-- edit final version -->
<button
type="button"
@ -570,9 +570,9 @@
<button
type="button"
class="red-warning-text"
*ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && !isFinalEdit"
mat-icon-button
matTooltip="{{ 'Delete final print template' | translate }}"
*ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && !isFinalEdit"
(click)="deleteModifiedFinalVersion()"
>
<mat-icon>delete</mat-icon>
@ -956,6 +956,7 @@
translate
(click)="setChangeRecoMode(ChangeRecoMode.Changed)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Changed }"
*ngIf="allChangingObjects && allChangingObjects.length"
>
Changed version
</button>
@ -964,6 +965,7 @@
translate
(click)="setChangeRecoMode(ChangeRecoMode.Diff)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Diff }"
*ngIf="allChangingObjects && allChangingObjects.length"
>
Diff version
</button>
@ -972,6 +974,7 @@
translate
(click)="setChangeRecoMode(ChangeRecoMode.Final)"
[ngClass]="{ selected: crMode === ChangeRecoMode.Final }"
*ngIf="allChangingObjects && allChangingObjects.length"
>
Final version
</button>

View File

@ -504,7 +504,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
.subscribe(mode => (this.lnMode = mode));
this.configService
.get<ChangeRecoMode>('motions_recommendation_text_mode')
.subscribe(mode => (this.crMode = mode));
.subscribe(mode => (this.crMode = this.determineCrMode(mode)));
this.configService
.get<boolean>('motions_show_sequential_numbers')
.subscribe(shown => (this.showSequential = shown));
@ -1418,6 +1418,21 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
}
}
/**
* Tries to determine the realistic CR-Mode from a given CR mode
*/
private determineCrMode(mode: ChangeRecoMode): ChangeRecoMode {
if (this.motion) {
if (mode === ChangeRecoMode.Final && this.motion.modified_final_version) {
return ChangeRecoMode.ModifiedFinal;
}
if ((mode === ChangeRecoMode.Diff || mode === ChangeRecoMode.Changed) && !this.allChangingObjects.length) {
return ChangeRecoMode.Original;
}
}
return mode;
}
/**
* Function to listen to notifications if the user edits this motion.
* Handles the notification messages.