Skip to content

Commit c001568

Browse files
committed
handle all floating promises
1 parent 8209c99 commit c001568

File tree

67 files changed

+247
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+247
-236
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
120120
// Check authentication when coming back online
121121
// This is also run on first load when the websocket connects for the first time
122122
if (status && !this.isAppLoading) {
123-
this.authService.checkOnlineAuth();
123+
void this.authService.checkOnlineAuth();
124124
}
125125
});
126126

@@ -280,7 +280,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
280280
if (this._selectedProjectDoc == null || !this._selectedProjectDoc.isLoaded) {
281281
return;
282282
}
283-
this.userService.setCurrentProjectId(this.currentUserDoc!, this._selectedProjectDoc.id);
283+
void this.userService.setCurrentProjectId(this.currentUserDoc!, this._selectedProjectDoc.id);
284284
this.projectUserConfigDoc = await this.projectService.getUserConfig(
285285
this._selectedProjectDoc.id,
286286
this.currentUserDoc!.id
@@ -292,7 +292,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
292292
// handle remotely deleted project
293293
const userDoc = this.currentUserDoc;
294294
if (userDoc != null && this.userService.currentProjectId(userDoc) != null) {
295-
this.showProjectDeletedDialog();
295+
void this.showProjectDeletedDialog();
296296
}
297297
});
298298

@@ -312,8 +312,8 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
312312
// See if the user was removed from the project
313313
if (!(this.currentUserDoc.id in this._selectedProjectDoc.data.userRoles)) {
314314
// The user has been removed from the project
315-
this.showProjectDeletedDialog();
316-
this.projectService.localDelete(this._selectedProjectDoc.id);
315+
void this.showProjectDeletedDialog();
316+
void this.projectService.localDelete(this._selectedProjectDoc.id);
317317
}
318318

319319
if (this.projectUserConfigDoc != null) {
@@ -349,31 +349,31 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
349349

350350
setLocale(locale: string): void {
351351
this.i18n.setLocale(locale);
352-
this.authService.updateInterfaceLanguage(locale);
352+
void this.authService.updateInterfaceLanguage(locale);
353353
}
354354

355355
changePassword(): void {
356356
if (this.currentUser == null) {
357357
return;
358358
} else if (!this.isAppOnline) {
359-
this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
359+
void this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
360360
} else {
361-
this.authService
361+
void this.authService
362362
.changePassword(this.currentUser.email)
363363
.then(() => {
364-
this.noticeService.show(this.i18n.translateStatic('app.password_reset_email_sent'));
364+
void this.noticeService.show(this.i18n.translateStatic('app.password_reset_email_sent'));
365365
})
366366
.catch(() => {
367-
this.dialogService.message('app.cannot_change_password');
367+
void this.dialogService.message('app.cannot_change_password');
368368
});
369369
}
370370
}
371371

372372
editName(): void {
373373
if (this.isAppOnline) {
374-
this.userService.editDisplayName(false);
374+
void this.userService.editDisplayName(false);
375375
} else {
376-
this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
376+
void this.noticeService.show(this.i18n.translateStatic('app.action_not_available_offline'));
377377
}
378378
}
379379

@@ -394,11 +394,11 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
394394
}
395395

396396
installOnDevice(): void {
397-
this.pwaService.install();
397+
void this.pwaService.install();
398398
}
399399

400400
logOut(): void {
401-
this.authService.logOut();
401+
void this.authService.logOut();
402402
}
403403

404404
collapseDrawer(): void {

src/SIL.XForge.Scripture/ClientApp/src/app/checking/chapter-audio-dialog/chapter-audio-dialog.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
243243
this.processUploadedFiles(e.dataTransfer.files);
244244
});
245245

246-
this.projectService.queryAudioText(this.data.projectId, this.destroyRef).then(query => {
246+
void this.projectService.queryAudioText(this.data.projectId, this.destroyRef).then(query => {
247247
this.textAudioQuery = query;
248248
this.populateExistingData();
249249
});
@@ -327,7 +327,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
327327
// if the upload fails, we need to show an error and not close the dialog
328328
this._loadingAudio = false;
329329
if (audioUrl == null) {
330-
this.dialogService.message('chapter_audio_dialog.upload_failed');
330+
void this.dialogService.message('chapter_audio_dialog.upload_failed');
331331
return;
332332
}
333333

@@ -517,7 +517,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
517517
}
518518
this._editState = true;
519519
this.timing = this.timing_processed = doc.timings;
520-
this.fileService
520+
void this.fileService
521521
.findOrUpdateCache(FileType.Audio, TextAudioDoc.COLLECTION, textAudioId, doc.audioUrl)
522522
.then(data => {
523523
if (data == null) {
@@ -530,7 +530,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
530530
fileName: this.i18n.localizeBook(this.data.currentBook!) + ' ' + this.data.currentChapter,
531531
status: 'uploaded'
532532
};
533-
this.audioUpdate(audioAttachment);
533+
void this.audioUpdate(audioAttachment);
534534
});
535535
});
536536
}
@@ -559,7 +559,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
559559
}
560560
const isTimingFile: boolean = TIMING_FILE_EXTENSION_REGEX.test(file.name);
561561
if (isTimingFile) {
562-
this.prepareTimingFileUpload(file);
562+
void this.prepareTimingFileUpload(file);
563563
} else {
564564
// if file is larger than 100MB, show an error
565565
if (file.size > 100_000_000) {
@@ -574,7 +574,7 @@ export class ChapterAudioDialogComponent implements AfterViewInit, OnDestroy {
574574
status: 'uploaded'
575575
};
576576

577-
this.audioUpdate(audioAttachment);
577+
void this.audioUpdate(audioAttachment);
578578
}
579579
}
580580
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export class CheckingOverviewComponent extends DataLoadingComponent implements O
333333
}
334334

335335
setQuestionArchiveStatus(questionDoc: QuestionDoc, archiveStatus: boolean): void {
336-
questionDoc.submitJson0Op(op => {
336+
void questionDoc.submitJson0Op(op => {
337337
op.set(q => q.isArchived, archiveStatus);
338338
if (archiveStatus) {
339339
op.set(q => q.dateArchived!, new Date().toJSON());

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ export class CheckingAnswersComponent implements OnInit {
169169
if (questionDoc == null) {
170170
return;
171171
}
172-
this.updateQuestionDocAudioUrls();
172+
void this.updateQuestionDocAudioUrls();
173173
if (this.questionChangeSubscription != null) {
174174
this.questionChangeSubscription!.unsubscribe();
175175
}
176176
this.questionChangeSubscription = questionDoc.remoteChanges$
177177
.pipe(quietTakeUntilDestroyed(this.destroyRef))
178178
.subscribe(ops => {
179-
this.updateQuestionDocAudioUrls();
179+
void this.updateQuestionDocAudioUrls();
180180
// If the user hasn't added an answer yet and is able to, then
181181
// don't hold back any incoming answers from appearing right away
182182
// as soon as the user adds their answer.
@@ -367,7 +367,7 @@ export class CheckingAnswersComponent implements OnInit {
367367
};
368368
const dialogResponseDoc: QuestionDoc | undefined = await this.questionDialogService.questionDialog(data);
369369
if (dialogResponseDoc?.data != null) {
370-
this.updateQuestionDocAudioUrls();
370+
void this.updateQuestionDocAudioUrls();
371371
this.action.emit({ action: 'edit', questionDoc: dialogResponseDoc });
372372
}
373373
}
@@ -396,7 +396,7 @@ export class CheckingAnswersComponent implements OnInit {
396396
result.audio.fileName
397397
);
398398
if (urlResult != null) {
399-
this.questionDoc.submitJson0Op(op => op.set(q => q.audioUrl, urlResult));
399+
void this.questionDoc.submitJson0Op(op => op.set(q => q.audioUrl, urlResult));
400400
}
401401
}
402402
}
@@ -454,9 +454,9 @@ export class CheckingAnswersComponent implements OnInit {
454454
answer
455455
});
456456
} else if (likeAnswerResponse === LikeAnswerResponse.DeniedOwnAnswer) {
457-
this.noticeService.show(this.i18n.translateStatic('checking_answers.cannot_like_own_answer'));
457+
void this.noticeService.show(this.i18n.translateStatic('checking_answers.cannot_like_own_answer'));
458458
} else if (likeAnswerResponse === LikeAnswerResponse.DeniedNoPermission) {
459-
this.noticeService.show(this.i18n.translateStatic('checking_answers.no_permission_to_like'));
459+
void this.noticeService.show(this.i18n.translateStatic('checking_answers.no_permission_to_like'));
460460
}
461461
}
462462

@@ -548,9 +548,9 @@ export class CheckingAnswersComponent implements OnInit {
548548
if (this.questionDoc?.data == null) {
549549
return;
550550
}
551-
this.cacheFileSource(this.questionDoc, this.questionDoc.data.dataId, this.questionDoc.data.audioUrl);
551+
void this.cacheFileSource(this.questionDoc, this.questionDoc.data.dataId, this.questionDoc.data.audioUrl);
552552
for (const answer of this.questionDoc.getAnswers()) {
553-
this.cacheFileSource(this.questionDoc, answer.dataId, answer.audioUrl);
553+
void this.cacheFileSource(this.questionDoc, answer.dataId, answer.audioUrl);
554554
}
555555
}
556556

@@ -590,7 +590,7 @@ export class CheckingAnswersComponent implements OnInit {
590590
this.hideAnswerForm();
591591
this.submittingAnswer = false;
592592
this.justEditedAnswer = true;
593-
this.updateQuestionDocAudioUrls();
593+
void this.updateQuestionDocAudioUrls();
594594
}
595595
});
596596
}
@@ -599,7 +599,7 @@ export class CheckingAnswersComponent implements OnInit {
599599
if (this.projectId == null) {
600600
return;
601601
}
602-
this.projectService.isProjectAdmin(this.projectId, this.userService.currentUserId).then(isProjectAdmin => {
602+
void this.projectService.isProjectAdmin(this.projectId, this.userService.currentUserId).then(isProjectAdmin => {
603603
this.isProjectAdmin = isProjectAdmin;
604604
});
605605
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class CheckingCommentsComponent extends SubscriptionDisposable implements
169169
}
170170
}
171171
if (commentIdsToMarkRead.length) {
172-
this.projectUserConfigDoc.submitJson0Op(op => {
172+
void this.projectUserConfigDoc.submitJson0Op(op => {
173173
for (const commentId of commentIdsToMarkRead) {
174174
op.add(puc => puc.commentRefsRead, commentId);
175175
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class CheckingQuestionsComponent implements OnInit, OnChanges {
8686
});
8787
this.setProjectAdmin();
8888

89-
this.questionsService
89+
void this.questionsService
9090
.queryFirstUnansweredQuestion(projectProfileDoc.id, this.userService.currentUserId, this.destroyRef)
9191
.then(query => {
9292
this._firstUnansweredQuestion = query;
@@ -325,7 +325,7 @@ export class CheckingQuestionsComponent implements OnInit, OnChanges {
325325
return;
326326
}
327327

328-
this._projectUserConfigDoc
328+
void this._projectUserConfigDoc
329329
.submitJson0Op(op => {
330330
if (questionDoc != null && questionDoc.data != null && !this.hasUserReadQuestion(questionDoc)) {
331331
op.add(puc => puc.questionRefsRead, questionDoc.data.dataId);
@@ -406,7 +406,7 @@ export class CheckingQuestionsComponent implements OnInit, OnChanges {
406406
this.activeQuestionDoc = questionDoc;
407407

408408
if (verseRef != null) {
409-
this.storeMostRecentQuestion().then(() => {
409+
void this.storeMostRecentQuestion().then(() => {
410410
// Only emit if not a filter to avoid duplicate emission, as an emit from filter is called elsewhere
411411
if (!actionSource?.isQuestionListChange) {
412412
this.changed.emit({ questionDoc, actionSource, clearFilter });
@@ -459,7 +459,7 @@ export class CheckingQuestionsComponent implements OnInit, OnChanges {
459459
if (this.projectId == null) {
460460
return;
461461
}
462-
this.projectService.isProjectAdmin(this.projectId, this.userService.currentUserId).then(isProjectAdmin => {
462+
void this.projectService.isProjectAdmin(this.projectId, this.userService.currentUserId).then(isProjectAdmin => {
463463
this.isProjectAdmin = isProjectAdmin;
464464
});
465465
}

src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-scripture-audio-player/checking-scripture-audio-player.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class CheckingScriptureAudioPlayerComponent implements AfterViewInit {
201201
if (this.audioPlayer == null) return;
202202
this._audioIsAvailable = false;
203203
// wait until the next microtask cycle to get the audio player with the updated source
204-
Promise.resolve(this.audioPlayer).then(audioPlayer => {
204+
void Promise.resolve(this.audioPlayer).then(audioPlayer => {
205205
this.audioSubscription?.unsubscribe();
206206
this.audioSubscription = audioPlayer.isAudioAvailable$
207207
.pipe(

0 commit comments

Comments
 (0)