RED-5219: do not show warning again

This commit is contained in:
Dan Percic 2022-12-13 17:44:32 +02:00
parent c97782f886
commit b7c874f58c
2 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ export class PreferencesComponent extends BaseFormComponent {
displaySuggestionsInPreview: [this.userPreferenceService.getDisplaySuggestionsInPreview()], displaySuggestionsInPreview: [this.userPreferenceService.getDisplaySuggestionsInPreview()],
// warnings preferences // warnings preferences
unapprovedSuggestionsWarning: [this.userPreferenceService.getUnapprovedSuggestionsWarning()], unapprovedSuggestionsWarning: [this.userPreferenceService.getUnapprovedSuggestionsWarning()],
loadAllAnnotationsWarning: [this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning, 'true')], loadAllAnnotationsWarning: [this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)],
}); });
if (!this._permissionsService.has(ROLES.managePreferences)) { if (!this._permissionsService.has(ROLES.managePreferences)) {
@ -74,7 +74,7 @@ export class PreferencesComponent extends BaseFormComponent {
if ( if (
this.form.controls.loadAllAnnotationsWarning.value !== this.form.controls.loadAllAnnotationsWarning.value !==
this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning, 'true') this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)
) { ) {
await this.userPreferenceService.save( await this.userPreferenceService.save(
PreferencesKeys.loadAllAnnotationsWarning, PreferencesKeys.loadAllAnnotationsWarning,

View File

@ -640,7 +640,7 @@ export class FilePreviewScreenComponent
filter(event => event.type === ViewerEvents.LOAD_ALL_ANNOTATIONS), filter(event => event.type === ViewerEvents.LOAD_ALL_ANNOTATIONS),
switchMap(() => this._fileDataService.annotations), switchMap(() => this._fileDataService.annotations),
switchMap<AnnotationWrapper[], Observable<readonly [boolean, AnnotationWrapper[]]>>(annotations => { switchMap<AnnotationWrapper[], Observable<readonly [boolean, AnnotationWrapper[]]>>(annotations => {
const showWarning = this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning, 'true'); const showWarning = !this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning);
const annotationsExceedThreshold = annotations.length >= this.configService.values.ANNOTATIONS_THRESHOLD; const annotationsExceedThreshold = annotations.length >= this.configService.values.ANNOTATIONS_THRESHOLD;
if (annotationsExceedThreshold && showWarning) { if (annotationsExceedThreshold && showWarning) {
@ -663,7 +663,7 @@ export class FilePreviewScreenComponent
switchMap(async (result: ConfirmOptions) => { switchMap(async (result: ConfirmOptions) => {
const doNotShowWarningAgain = result === ConfirmOptions.SECOND_CONFIRM; const doNotShowWarningAgain = result === ConfirmOptions.SECOND_CONFIRM;
if (doNotShowWarningAgain) { if (doNotShowWarningAgain) {
await this.userPreferenceService.save(PreferencesKeys.loadAllAnnotationsWarning, 'false'); await this.userPreferenceService.save(PreferencesKeys.loadAllAnnotationsWarning, 'true');
await this.userPreferenceService.reload(); await this.userPreferenceService.reload();
} }
const shouldLoad = [ConfirmOptions.CONFIRM, ConfirmOptions.SECOND_CONFIRM].includes(result); const shouldLoad = [ConfirmOptions.CONFIRM, ConfirmOptions.SECOND_CONFIRM].includes(result);