Change motion cr mode view behavior

if the default cr mode is 'original' nothing really happens
if the default cr mode is 'changed' you will stay in original view after
creating cr's. That's due to the autoupdate limitation. Changing this
would mean that you cannot change the view anymore
if the default cd mode is 'diff' you will switch to diff view after
creating a cr. It seems that the diff view has an automatic fallback to
the original view if no cr exists, perhaps Tobias knows more about that.
If the default cr mode if 'final' you will try to change to
mod-final-version if it exists. If there is no change-reco, you will
fall back to original version.
This commit is contained in:
Sean 2020-05-13 13:01:58 +02:00 committed by Emanuel Schütze
parent b7b27d2e88
commit 853bc31e21

View File

@ -532,9 +532,11 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
this.configService
.get<LineNumberingMode>('motions_default_line_numbering')
.subscribe(mode => (this.lnMode = mode));
this.configService
.get<ChangeRecoMode>('motions_recommendation_text_mode')
.subscribe(mode => (this.crMode = this.determineCrMode(mode)));
this.configService.get<ChangeRecoMode>('motions_recommendation_text_mode').subscribe(mode => {
if (mode) {
this.crMode = this.determineCrMode(mode);
}
});
this.configService
.get<boolean>('motions_show_sequential_numbers')
.subscribe(shown => (this.showSequential = shown));
@ -674,7 +676,9 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
// allChangingObjects, we set "diff" first in this case (in the config-listener) and perform the actual
// check if "diff" is possible now.
// Test: "diff" as default view. Open a motion, create an amendment. "Original" should be set automatically.
this.crMode = this.determineCrMode(this.crMode);
if (this.crMode) {
this.crMode = this.determineCrMode(this.crMode);
}
this.cd.markForCheck();
}
@ -1531,13 +1535,22 @@ 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) {
if (mode === ChangeRecoMode.Final) {
if (this.motion?.modified_final_version) {
return ChangeRecoMode.ModifiedFinal;
}
if ((mode === ChangeRecoMode.Diff || mode === ChangeRecoMode.Changed) && !this.allChangingObjects.length) {
/**
* Because without change recos you cannot escape the final version anymore
*/
} else if (!this.allChangingObjects?.length) {
return ChangeRecoMode.Original;
}
} else if (mode === ChangeRecoMode.Changed && !this.allChangingObjects?.length) {
/**
* Because without change recos you cannot escape the changed version view
* You will not be able to automatically change to the Changed view after creating
* a change reco. The autoupdate has to come "after" this routine
*/
return ChangeRecoMode.Original;
}
return mode;
}