Skip to content

Commit bc47d27

Browse files
siltomatoRaymondLuong3
authored andcommitted
code review changes
1 parent 07e7fcd commit bc47d27

File tree

27 files changed

+63
-65
lines changed

27 files changed

+63
-65
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
355355
if (this.currentUser == null) {
356356
return;
357357
} else if (!this.isAppOnline) {
358-
void this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
358+
this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
359359
} else {
360360
void this.authService
361361
.changePassword(this.currentUser.email)
362362
.then(() => {
363-
void this.noticeService.show(this.i18n.translateStatic('app.password_reset_email_sent'));
363+
this.noticeService.show(this.i18n.translateStatic('app.password_reset_email_sent'));
364364
})
365365
.catch(() => {
366366
void this.dialogService.message('app.cannot_change_password');
@@ -372,7 +372,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
372372
if (this.isAppOnline) {
373373
void this.userService.editDisplayName(false);
374374
} else {
375-
void this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
375+
this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
376376
}
377377
}
378378

src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-answers/checking-answers.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ export class CheckingAnswersComponent implements OnInit {
445445
answer
446446
});
447447
} else if (likeAnswerResponse === LikeAnswerResponse.DeniedOwnAnswer) {
448-
void this.noticeService.show(this.i18n.translateStatic('checking_answers.cannot_like_own_answer'));
448+
this.noticeService.show(this.i18n.translateStatic('checking_answers.cannot_like_own_answer'));
449449
} else if (likeAnswerResponse === LikeAnswerResponse.DeniedNoPermission) {
450-
void this.noticeService.show(this.i18n.translateStatic('checking_answers.no_permission_to_like'));
450+
this.noticeService.show(this.i18n.translateStatic('checking_answers.no_permission_to_like'));
451451
}
452452
}
453453

src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
858858
break;
859859
case 'delete':
860860
if (answerAction.answer != null) {
861-
this.deleteAnswer(answerAction.answer);
861+
void this.deleteAnswer(answerAction.answer);
862862
}
863863
break;
864864
case 'edit':
@@ -1278,7 +1278,7 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
12781278
: activeQuestionDoc.data.answers.findIndex(existingAnswer => existingAnswer.dataId === answer.dataId);
12791279
}
12801280

1281-
private deleteAnswer(answer: Answer): void {
1281+
private async deleteAnswer(answer: Answer): Promise<void> {
12821282
if (this.questionsList == null) {
12831283
return;
12841284
}
@@ -1288,7 +1288,7 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
12881288
}
12891289
const answerIndex = this.getAnswerIndex(answer);
12901290
if (answerIndex >= 0) {
1291-
void activeQuestionDoc
1291+
await activeQuestionDoc
12921292
.submitJson0Op(op => {
12931293
op.set(q => q.answers[answerIndex].deleted, true);
12941294
})

src/SIL.XForge.Scripture/ClientApp/src/app/checking/import-questions-dialog/import-questions-dialog.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TranslocoService } from '@ngneat/transloco';
66
import { Canon, VerseRef } from '@sillsdev/scripture';
77
import { Question } from 'realtime-server/lib/esm/scriptureforge/models/question';
88
import { fromVerseRef, toVerseRef } from 'realtime-server/lib/esm/scriptureforge/models/verse-ref-data';
9-
import { lastValueFrom, Subject } from 'rxjs';
9+
import { Subject } from 'rxjs';
1010
import { CsvService } from 'xforge-common/csv-service.service';
1111
import { DialogService } from 'xforge-common/dialog.service';
1212
import { ExternalUrlService } from 'xforge-common/external-url.service';
@@ -500,11 +500,13 @@ export class ImportQuestionsDialogComponent implements OnDestroy {
500500
ImportQuestionsConfirmationDialogComponent,
501501
data
502502
) as MatDialogRef<ImportQuestionsConfirmationDialogComponent, ImportQuestionsConfirmationDialogResult>;
503-
const result: ImportQuestionsConfirmationDialogResult | undefined = await lastValueFrom(dialogRef.afterClosed());
504-
if (result != null) {
505-
result.forEach((checked, index) => (changesToConfirm[index].checked = checked));
506-
}
507-
this.updateSelectAllCheckbox();
503+
504+
dialogRef.afterClosed().subscribe((result: ImportQuestionsConfirmationDialogResult | undefined) => {
505+
if (result != null) {
506+
result.forEach((checked, index) => (changesToConfirm[index].checked = checked));
507+
}
508+
this.updateSelectAllCheckbox();
509+
});
508510
}
509511

510512
private questionsDiffer(listItem: DialogListItem): boolean {

src/SIL.XForge.Scripture/ClientApp/src/app/checking/question-dialog/question-dialog.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class QuestionDialogService {
4444
return questionDoc;
4545
}
4646
if (!(await this.canCreateAndEditQuestions(config.projectId))) {
47-
void this.noticeService.show(this.transloco.translate('question_dialog.add_question_denied'));
47+
this.noticeService.show(this.transloco.translate('question_dialog.add_question_denied'));
4848
return undefined;
4949
}
5050
const questionId = questionDoc != null && questionDoc.data != null ? questionDoc.data.dataId : objectId();

src/SIL.XForge.Scripture/ClientApp/src/app/machine-api/remote-translation-engine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ export class RemoteTranslationEngine implements InteractiveTranslationEngine {
9797
return this.createWordGraph(response.data as WordGraphDto);
9898
} catch (err: any) {
9999
if (err.status === 403 || err.status === 404 || err.status === 409) {
100-
void this.noticeService.showError(
100+
this.noticeService.showError(
101101
this.i18n.translateStatic('error_messages.suggestion_engine_requires_retrain'),
102102
this.i18n.translateStatic('error_messages.go_to_retrain'),
103103
() => {
104104
void this.router.navigate(['projects', this.projectId, 'translate']);
105105
}
106106
);
107107
} else {
108-
void this.noticeService.showError(this.i18n.translateStatic('error_messages.failed_to_retrieve_suggestions'));
108+
this.noticeService.showError(this.i18n.translateStatic('error_messages.failed_to_retrieve_suggestions'));
109109
}
110110
}
111111

src/SIL.XForge.Scripture/ClientApp/src/app/my-projects/my-projects.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class MyProjectsComponent implements OnInit {
123123
await this.projectService.onlineAddCurrentUser(projectId);
124124
void this.router.navigate(['projects', projectId]);
125125
} catch {
126-
void this.noticeService.show(this.i18n.translateStatic('my_projects.failed_to_join_project'));
126+
this.noticeService.show(this.i18n.translateStatic('my_projects.failed_to_join_project'));
127127
} finally {
128128
this.noticeService.loadingFinished(this.constructor.name);
129129
this.joiningProjects.pop();
@@ -134,11 +134,11 @@ export class MyProjectsComponent implements OnInit {
134134
try {
135135
this.noticeService.loadingStarted(this.constructor.name);
136136
await this.projectService.onlineSyncUserRole(projectId);
137-
void this.noticeService.show(this.i18n.translateStatic('my_projects.user_role_updated'));
137+
this.noticeService.show(this.i18n.translateStatic('my_projects.user_role_updated'));
138138
const project = this.userParatextProjects.find(project => project.projectId === projectId);
139139
if (project != null) project.hasUserRoleChanged = false;
140140
} catch {
141-
void this.noticeService.showError(this.i18n.translateStatic('my_projects.failed_to_update_user_role'));
141+
this.noticeService.showError(this.i18n.translateStatic('my_projects.failed_to_update_user_role'));
142142
} finally {
143143
this.noticeService.loadingFinished(this.constructor.name);
144144
}

src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/serval-project.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class ServalProjectComponent extends DataLoadingComponent implements OnIn
220220
this.downloadBooksProgress = draftZipProgress.current;
221221
this.downloadBooksTotal = draftZipProgress.total;
222222
},
223-
error: (error: Error) => void this.noticeService.showError(error.message)
223+
error: (error: Error) => this.noticeService.showError(error.message)
224224
});
225225
}
226226

@@ -244,7 +244,7 @@ export class ServalProjectComponent extends DataLoadingComponent implements OnIn
244244

245245
// If the blob is undefined, display an error
246246
if (blob == null) {
247-
void this.noticeService.showError('The project was never synced successfully and does not exist on disk.');
247+
this.noticeService.showError('The project was never synced successfully and does not exist on disk.');
248248
return;
249249
}
250250

@@ -260,7 +260,7 @@ export class ServalProjectComponent extends DataLoadingComponent implements OnIn
260260

261261
async retrievePreTranslationStatus(): Promise<void> {
262262
await this.servalAdministrationService.onlineRetrievePreTranslationStatus(this.activatedProjectService.projectId!);
263-
await this.noticeService.show('Webhook job started.');
263+
this.noticeService.show('Webhook job started.');
264264
}
265265

266266
navigateToDraftJobs(): void {

src/SIL.XForge.Scripture/ClientApp/src/app/shared/audio-recorder-dialog/audio-recorder-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ export class AudioRecorderDialogComponent implements ControlValueAccessor, OnIni
232232
this.audio = { status: 'denied' };
233233

234234
if (error.code === DOMException.NOT_FOUND_ERR) {
235-
void this.noticeService.show(this.i18n.translateStatic('checking_audio_recorder.mic_not_found'));
235+
this.noticeService.show(this.i18n.translateStatic('checking_audio_recorder.mic_not_found'));
236236
} else {
237-
void this.noticeService.show(this.i18n.translateStatic('checking_audio_recorder.mic_access_denied'));
237+
this.noticeService.show(this.i18n.translateStatic('checking_audio_recorder.mic_access_denied'));
238238
}
239239
}
240240

src/SIL.XForge.Scripture/ClientApp/src/app/shared/share/share-control.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class ShareControlComponent extends ShareBaseComponent {
186186
}
187187
}
188188

189-
void this.noticeService.show(message);
189+
this.noticeService.show(message);
190190

191191
const roleValue = this.shareRole;
192192
const localeValue = this.localeControl.value;

0 commit comments

Comments
 (0)