MOBILE-4081 chore: Remove redundant awaits

main
Pau Ferrer Ocaña 2022-08-31 16:49:31 +02:00
parent 5828560771
commit f0b79822da
46 changed files with 88 additions and 90 deletions

View File

@ -369,14 +369,14 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
protected async refreshCourseList(data: CoreCoursesMyCoursesUpdatedEventData): Promise<void> {
if (data.action == CoreCoursesProvider.ACTION_ENROL) {
// Always update if user enrolled in a course.
return await this.refreshContent();
return this.refreshContent();
}
const course = this.allCourses.find((course) => course.id == data.courseId);
if (data.action == CoreCoursesProvider.ACTION_STATE_CHANGED) {
if (!course) {
// Not found, use WS update.
return await this.refreshContent();
return this.refreshContent();
}
if (data.state == CoreCoursesProvider.STATE_FAVOURITE) {
@ -394,7 +394,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
if (data.action == CoreCoursesProvider.ACTION_VIEW && data.courseId != CoreSites.getCurrentSiteHomeId()) {
if (!course) {
// Not found, use WS update.
return await this.refreshContent();
return this.refreshContent();
}
course.lastaccess = CoreTimeUtils.timestamp();

View File

@ -171,7 +171,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
protected async refreshCourseList(data: CoreCoursesMyCoursesUpdatedEventData): Promise<void> {
if (data.action == CoreCoursesProvider.ACTION_ENROL) {
// Always update if user enrolled in a course.
return await this.refreshContent();
return this.refreshContent();
}
const courseIndex = this.courses.findIndex((course) => course.id == data.courseId);
@ -179,7 +179,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
if (data.action == CoreCoursesProvider.ACTION_VIEW && data.courseId != CoreSites.getCurrentSiteHomeId()) {
if (!course) {
// Not found, use WS update.
return await this.refreshContent();
return this.refreshContent();
}
// Place at the begining.

View File

@ -159,14 +159,14 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
if (data.action == CoreCoursesProvider.ACTION_ENROL) {
// Always update if user enrolled in a course.
// New courses shouldn't be favourite by default, but just in case.
return await this.refreshContent();
return this.refreshContent();
}
if (data.action == CoreCoursesProvider.ACTION_STATE_CHANGED && data.state == CoreCoursesProvider.STATE_FAVOURITE) {
const courseIndex = this.courses.findIndex((course) => course.id == data.courseId);
if (courseIndex < 0) {
// Not found, use WS update. Usually new favourite.
return await this.refreshContent();
return this.refreshContent();
}
const course = this.courses[courseIndex];

View File

@ -47,7 +47,7 @@ export class AddonBlockStarredCoursesProvider {
cacheKey: this.getStarredCoursesCacheKey(),
};
return await site.read<AddonBlockStarredCourse[]>('block_starredcourses_get_starred_courses', undefined, preSets);
return site.read<AddonBlockStarredCourse[]>('block_starredcourses_get_starred_courses', undefined, preSets);
}
/**

View File

@ -74,7 +74,7 @@ export class AddonCalendarOfflineProvider {
async getAllDeletedEvents(siteId?: string): Promise<AddonCalendarOfflineDeletedEventDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(DELETED_EVENTS_TABLE);
return site.getDb().getRecords(DELETED_EVENTS_TABLE);
}
/**
@ -98,7 +98,7 @@ export class AddonCalendarOfflineProvider {
async getAllEditedEvents(siteId?: string): Promise<AddonCalendarOfflineEventDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(EVENTS_TABLE);
return site.getDb().getRecords(EVENTS_TABLE);
}
/**
@ -126,7 +126,7 @@ export class AddonCalendarOfflineProvider {
id: eventId,
};
return await site.getDb().getRecord(DELETED_EVENTS_TABLE, conditions);
return site.getDb().getRecord(DELETED_EVENTS_TABLE, conditions);
}
/**
@ -142,7 +142,7 @@ export class AddonCalendarOfflineProvider {
id: eventId,
};
return await site.getDb().getRecord(EVENTS_TABLE, conditions);
return site.getDb().getRecord(EVENTS_TABLE, conditions);
}
/**
@ -209,7 +209,7 @@ export class AddonCalendarOfflineProvider {
timemodified: Date.now(),
};
return await site.getDb().insertRecord(DELETED_EVENTS_TABLE, event);
return site.getDb().insertRecord(DELETED_EVENTS_TABLE, event);
}
/**

View File

@ -503,7 +503,7 @@ export class AddonCalendarProvider {
async getAllEventsFromLocalDb(siteId?: string): Promise<AddonCalendarEventDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getAllRecords(EVENTS_TABLE);
return site.getDb().getAllRecords(EVENTS_TABLE);
}
/**
@ -916,7 +916,7 @@ export class AddonCalendarProvider {
async getEventReminders(id: number, siteId?: string): Promise<AddonCalendarReminderDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(REMINDERS_TABLE, { eventid: id }, 'timecreated ASC, time ASC');
return site.getDb().getRecords(REMINDERS_TABLE, { eventid: id }, 'timecreated ASC, time ASC');
}
/**
@ -1021,7 +1021,7 @@ export class AddonCalendarProvider {
async getLocalEventsByRepeatIdFromLocalDb(repeatId: number, siteId?: string): Promise<AddonCalendarEventDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(EVENTS_TABLE, { repeatid: repeatId });
return site.getDb().getRecords(EVENTS_TABLE, { repeatid: repeatId });
}
/**

View File

@ -57,7 +57,7 @@ export class AddonCourseCompletionUserHandlerService implements CoreUserProfileH
* @inheritdoc
*/
async isEnabledForUser(user: CoreUserProfile, context: CoreUserDelegateContext, contextId: number): Promise<boolean> {
return await AddonCourseCompletion.isPluginViewEnabledForUser(contextId, user.id);
return AddonCourseCompletion.isPluginViewEnabledForUser(contextId, user.id);
}
/**

View File

@ -34,7 +34,7 @@ export class AddonMessagesSettingsHandlerService implements CoreSettingsHandler
* @return Whether or not the handler is enabled on a site level.
*/
async isEnabled(): Promise<boolean> {
return await AddonMessages.isPluginEnabled();
return AddonMessages.isPluginEnabled();
}
/**

View File

@ -1620,13 +1620,12 @@ export class AddonMessagesProvider {
preSets.emergencyCache = false;
}
return await this.getMessages(params, preSets, siteId);
return this.getMessages(params, preSets, siteId);
}
/**
* Invalidate all contacts cache.
*
* @param userId The user ID.
* @param siteId Site ID. If not defined, current site.
* @return Resolved when done.
*/
@ -2517,7 +2516,7 @@ export class AddonMessagesProvider {
messages,
};
return await site.write('core_message_send_instant_messages', data);
return site.write('core_message_send_instant_messages', data);
}
/**
@ -2651,7 +2650,7 @@ export class AddonMessagesProvider {
})),
};
return await site.write('core_message_send_messages_to_conversation', params);
return site.write('core_message_send_messages_to_conversation', params);
}
/**

View File

@ -389,7 +389,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
return;
}
return await AddonModAssignSync.syncAssign(this.assign.id);
return AddonModAssignSync.syncAssign(this.assign.id);
}
/**

View File

@ -329,7 +329,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
// Cannot submit in online, prepare for offline usage.
this.saveOffline = true;
return await AddonModAssignHelper.prepareSubmissionPluginData(
return AddonModAssignHelper.prepareSubmissionPluginData(
this.assign!,
this.userSubmission,
inputData,

View File

@ -353,7 +353,7 @@ export class AddonModAssignOfflineProvider {
};
}
return await site.getDb().insertRecord(SUBMISSIONS_TABLE, submission);
return site.getDb().insertRecord(SUBMISSIONS_TABLE, submission);
}
/**
@ -393,7 +393,7 @@ export class AddonModAssignOfflineProvider {
onlinetimemodified: timemodified,
};
return await site.getDb().insertRecord(SUBMISSIONS_TABLE, entry);
return site.getDb().insertRecord(SUBMISSIONS_TABLE, entry);
}
/**
@ -442,7 +442,7 @@ export class AddonModAssignOfflineProvider {
timemodified: now,
};
return await site.getDb().insertRecord(SUBMISSIONS_GRADES_TABLE, entry);
return site.getDb().insertRecord(SUBMISSIONS_GRADES_TABLE, entry);
}
}

View File

@ -203,7 +203,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
plugin: AddonModAssignPlugin,
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(plugin.type, 'discardDraft', [assignId, userId, siteId]);
return this.executeFunctionOnEnabled(plugin.type, 'discardDraft', [assignId, userId, siteId]);
}
/**
@ -215,7 +215,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
async getComponentForPlugin(
plugin: AddonModAssignPlugin,
): Promise<Type<IAddonModAssignFeedbackPluginComponent> | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'getComponent', [plugin]);
return this.executeFunctionOnEnabled(plugin.type, 'getComponent', [plugin]);
}
/**
@ -233,7 +233,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
plugin: AddonModAssignPlugin,
siteId?: string,
): Promise<T | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'getDraft', [assignId, userId, siteId]);
return this.executeFunctionOnEnabled(plugin.type, 'getDraft', [assignId, userId, siteId]);
}
/**
@ -285,7 +285,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
inputData: CoreFormFields,
userId: number,
): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'hasDataChanged',
[assign, submission, plugin, inputData, userId],
@ -307,7 +307,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
plugin: AddonModAssignPlugin,
siteId?: string,
): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'hasDraftData', [assignId, userId, siteId]);
return this.executeFunctionOnEnabled(plugin.type, 'hasDraftData', [assignId, userId, siteId]);
}
/**
@ -335,7 +335,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
plugin: AddonModAssignPlugin,
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId]);
return this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId]);
}
/**
@ -356,7 +356,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'prepareFeedbackData',
[assignId, userId, plugin, pluginData, siteId],
@ -380,7 +380,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
inputData: CoreFormFields,
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'saveDraft',
[assignId, userId, plugin, inputData, siteId],

View File

@ -293,7 +293,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
submission: AddonModAssignSubmission,
plugin: AddonModAssignPlugin,
): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'canEditOffline', [assign, submission, plugin]);
return this.executeFunctionOnEnabled(plugin.type, 'canEditOffline', [assign, submission, plugin]);
}
/**
@ -330,7 +330,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
userId?: number,
siteId?: string,
): Promise<void | undefined> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'copySubmissionData',
[assign, plugin, pluginData, userId, siteId],
@ -354,7 +354,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
offlineData: AddonModAssignSubmissionsDBRecordFormatted,
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'deleteOfflineData',
[assign, submission, plugin, offlineData, siteId],
@ -372,7 +372,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
plugin: AddonModAssignPlugin,
edit?: boolean,
): Promise<Type<AddonModAssignSubmissionPluginBaseComponent> | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'getComponent', [plugin, edit]);
return this.executeFunctionOnEnabled(plugin.type, 'getComponent', [plugin, edit]);
}
/**
@ -415,7 +415,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
* @return Promise resolved with size.
*/
async getPluginSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number | undefined> {
return await this.executeFunctionOnEnabled(plugin.type, 'getSizeForCopy', [assign, plugin]);
return this.executeFunctionOnEnabled(plugin.type, 'getSizeForCopy', [assign, plugin]);
}
/**
@ -433,7 +433,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
plugin: AddonModAssignPlugin,
inputData: CoreFormFields,
): Promise<number | undefined> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'getSizeForEdit',
[assign, submission, plugin, inputData],
@ -455,7 +455,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
plugin: AddonModAssignPlugin,
inputData: CoreFormFields,
): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'hasDataChanged',
[assign, submission, plugin, inputData],
@ -479,7 +479,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
* @return Whether it's supported for edit.
*/
async isPluginSupportedForEdit(pluginType: string): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(pluginType, 'isEnabledForEdit');
return this.executeFunctionOnEnabled(pluginType, 'isEnabledForEdit');
}
/**
@ -508,7 +508,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
plugin: AddonModAssignPlugin,
siteId?: string,
): Promise<void> {
return await this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId]);
return this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId]);
}
/**
@ -535,7 +535,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
siteId?: string,
): Promise<void | undefined> {
return await this.executeFunctionOnEnabled(
return this.executeFunctionOnEnabled(
plugin.type,
'prepareSubmissionData',
[assign, submission, plugin, inputData, pluginData, offline, userId, siteId],

View File

@ -166,7 +166,7 @@ export class AddonModBBBService {
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
return await site.read<AddonModBBBMeetingInfoWSResponse>(
return site.read<AddonModBBBMeetingInfoWSResponse>(
'mod_bigbluebuttonbn_meeting_info',
params,
preSets,

View File

@ -225,7 +225,7 @@ export class AddonModFeedbackHelperProvider {
protected async addImageProfile(
entries: (AddonModFeedbackWSAttempt | AddonModFeedbackWSNonRespondent)[],
): Promise<(AddonModFeedbackAttempt | AddonModFeedbackNonRespondent)[]> {
return await Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {
return Promise.all(entries.map(async (entry: AddonModFeedbackAttempt | AddonModFeedbackNonRespondent) => {
try {
const user = await CoreUser.getProfile(entry.userid, entry.courseid, true);

View File

@ -119,7 +119,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
throw new Error('Failed getting discussions');
}
return await Promise.all(
return Promise.all(
response.discussions.map((discussion) => AddonModForum.getDiscussionPosts(discussion.discussion, options)),
);
}));

View File

@ -518,7 +518,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
};
}
return await AddonModH5PActivitySync.syncActivity(this.h5pActivity.context, this.site.getId());
return AddonModH5PActivitySync.syncActivity(this.h5pActivity.context, this.site.getId());
}
/**

View File

@ -143,7 +143,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
h5pActivity: AddonModH5PActivityData,
users: AddonModH5PActivityUserAttempts[],
): Promise<AddonModH5PActivityUserAttemptsFormatted[]> {
return await Promise.all(users.map(async (user: AddonModH5PActivityUserAttemptsFormatted) => {
return Promise.all(users.map(async (user: AddonModH5PActivityUserAttemptsFormatted) => {
user.user = await CoreUser.getProfile(user.userid, this.courseId, true);
// Calculate the score of the user.

View File

@ -115,7 +115,7 @@ export class AddonNotesOfflineProvider {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(NOTES_TABLE, { userid: userId, courseid: courseId });
return site.getDb().getRecords(NOTES_TABLE, { userid: userId, courseid: courseId });
}
/**
@ -141,7 +141,7 @@ export class AddonNotesOfflineProvider {
async getNotesForUser(userId: number, siteId?: string): Promise<AddonNotesDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(NOTES_TABLE, { userid: userId });
return site.getDb().getRecords(NOTES_TABLE, { userid: userId });
}
/**
@ -154,7 +154,7 @@ export class AddonNotesOfflineProvider {
async getNotesWithPublishState(state: AddonNotesPublishState, siteId?: string): Promise<AddonNotesDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(NOTES_TABLE, { publishstate: state });
return site.getDb().getRecords(NOTES_TABLE, { publishstate: state });
}
/**

View File

@ -177,7 +177,7 @@ export class AddonNotesProvider {
throw error;
}
return await storeOffline();
return storeOffline();
}
}

View File

@ -60,7 +60,7 @@ export class AddonRemoteThemesHandlerService implements CoreStyleHandler {
}
// Config received, it's a temp site.
return await this.getRemoteStyles(config.mobilecssurl);
return this.getRemoteStyles(config.mobilecssurl);
}
const site = await CoreSites.getSite(siteId);
@ -108,7 +108,7 @@ export class AddonRemoteThemesHandlerService implements CoreStyleHandler {
return '';
}
return await CoreWS.getText(url);
return CoreWS.getText(url);
}
/**

View File

@ -96,7 +96,7 @@ export class AddonReportInsightsActionLinkHandlerService extends CoreContentLink
return false;
}
return await AddonReportInsights.canSendActionInSite(siteId);
return AddonReportInsights.canSendActionInSite(siteId);
}
}

View File

@ -2134,7 +2134,7 @@ export class CoreSite {
async getLastViewed(component: string, id: number): Promise<CoreSiteLastViewedDBRecord | undefined> {
try {
return await this.lastViewedTable.getOneByPrimaryKey({ component, id });
} catch (error) {
} catch {
// Not found.
}
}
@ -2162,7 +2162,7 @@ export class CoreSite {
sqlParams: whereAndParams.params,
js: (record) => record.component === component && ids.includes(record.id),
});
} catch (error) {
} catch {
// Not found.
}
}

View File

@ -569,7 +569,7 @@ export class CoreTabsBaseComponent<T extends CoreTabBase> implements OnInit, Aft
* @inheritdoc
*/
async ready(): Promise<void> {
return await this.onReadyPromise;
return this.onReadyPromise;
}
/**

View File

@ -116,7 +116,7 @@ export class CoreCommentsOfflineProvider {
async getAllDeletedComments(siteId?: string): Promise<CoreCommentsDeletedDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(COMMENTS_DELETED_TABLE);
return site.getDb().getRecords(COMMENTS_DELETED_TABLE);
}
/**

View File

@ -176,7 +176,7 @@ export class CoreCommentsProvider {
comments: comments,
};
return await site.write('core_comment_add_comments', data);
return site.write('core_comment_add_comments', data);
}
/**

View File

@ -301,7 +301,7 @@ export class CoreContentLinksDelegateService {
return true;
}
return await handler.isEnabled(siteId, url, params, courseId);
return handler.isEnabled(siteId, url, params, courseId);
}
/**

View File

@ -1017,10 +1017,10 @@ export class CoreCourseHelperProvider {
if (prefetchHandler) {
// Use the prefetch handler to download the module.
if (prefetchHandler.download) {
return await prefetchHandler.download(module, courseId);
return prefetchHandler.download(module, courseId);
}
return await prefetchHandler.prefetch(module, courseId, true);
return prefetchHandler.prefetch(module, courseId, true);
}
// There's no prefetch handler for the module, just download the files.

View File

@ -46,7 +46,7 @@ export class CoreCourseOfflineProvider {
async getAllManualCompletions(siteId?: string): Promise<CoreCourseManualCompletionDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(MANUAL_COMPLETION_TABLE);
return site.getDb().getRecords(MANUAL_COMPLETION_TABLE);
}
/**
@ -59,7 +59,7 @@ export class CoreCourseOfflineProvider {
async getCourseManualCompletions(courseId: number, siteId?: string): Promise<CoreCourseManualCompletionDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecords(MANUAL_COMPLETION_TABLE, { courseid: courseId });
return site.getDb().getRecords(MANUAL_COMPLETION_TABLE, { courseid: courseId });
}
/**
@ -72,7 +72,7 @@ export class CoreCourseOfflineProvider {
async getManualCompletion(cmId: number, siteId?: string): Promise<CoreCourseManualCompletionDBRecord> {
const site = await CoreSites.getSite(siteId);
return await site.getDb().getRecord(MANUAL_COMPLETION_TABLE, { cmid: cmId });
return site.getDb().getRecord(MANUAL_COMPLETION_TABLE, { cmid: cmId });
}
/**

View File

@ -484,7 +484,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate<CoreCourseOpt
// Load course options if missing.
await this.loadCourseOptions(course, refresh);
return await this.hasHandlersForDefault(course.id, refresh, course.navOptions, course.admOptions);
return this.hasHandlersForDefault(course.id, refresh, course.navOptions, course.admOptions);
}
/**

View File

@ -978,7 +978,7 @@ export class CoreCourseProvider {
async getViewedModules(courseId: number, siteId?: string): Promise<CoreCourseViewedModulesDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return await this.viewedModulesTables[site.getId()].getMany({ courseId }, {
return this.viewedModulesTables[site.getId()].getMany({ courseId }, {
sorting: [
{ timeaccess: 'desc' },
],

View File

@ -394,7 +394,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate<CoreCourseForm
* @return Whether course view should be refreshed when an activity completion changes.
*/
async shouldRefreshWhenCompletionChanges(course: CoreCourseAnyCourseData): Promise<boolean | undefined> {
return await this.executeFunctionOnEnabled(course.format || '', 'shouldRefreshWhenCompletionChanges', [course]);
return this.executeFunctionOnEnabled(course.format || '', 'shouldRefreshWhenCompletionChanges', [course]);
}
}

View File

@ -326,7 +326,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate<CoreCourseModu
courseId: number,
options?: CoreNavigationOptions,
): Promise<void> {
return await this.executeFunctionOnEnabled<void>(
return this.executeFunctionOnEnabled<void>(
modname,
'openActivityPage',
[module, courseId, options],

View File

@ -103,7 +103,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
}
if (handler.canUseCheckUpdates) {
return await handler.canUseCheckUpdates(module, courseId);
return handler.canUseCheckUpdates(module, courseId);
}
// By default, modules can use check updates.
@ -510,7 +510,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
if (handler?.getFiles) {
// The handler defines a function to get files, use it.
return await handler.getFiles(module, courseId);
return handler.getFiles(module, courseId);
} else if (handler?.loadContents) {
// The handler defines a function to load contents, use it before returning module contents.
await handler.loadContents(module, courseId);
@ -1000,7 +1000,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
if (handler?.hasUpdates) {
// Handler implements its own function to check the updates, use it.
return await handler.hasUpdates(module, courseId, moduleUpdates);
return handler.hasUpdates(module, courseId, moduleUpdates);
} else if (!moduleUpdates || !moduleUpdates.updates || !moduleUpdates.updates.length) {
// Module doesn't have any update.
return false;

View File

@ -666,7 +666,7 @@ export class CoreCoursesProvider {
cacheKey: this.getRecentCoursesCacheKey(userId),
};
return await site.read<CoreCourseSummaryData[]>('core_course_get_recent_courses', params, preSets);
return site.read<CoreCourseSummaryData[]>('core_course_get_recent_courses', params, preSets);
}
/**
@ -720,7 +720,6 @@ export class CoreCoursesProvider {
/**
* Get the common part of the cache keys for user navigation options WS calls.
*
* @param courseIds IDs of courses to get.
* @return Cache key.
*/
protected getUserNavigationOptionsCommonCacheKey(): string {

View File

@ -145,7 +145,7 @@ export class CoreCoursesDashboardProvider {
): Promise<void> {
const site = await CoreSites.getSite(siteId);
return await site.invalidateWsCacheForKey(this.getDashboardBlocksCacheKey(myPage, userId));
return site.invalidateWsCacheForKey(this.getDashboardBlocksCacheKey(myPage, userId));
}
/**

View File

@ -442,7 +442,7 @@ export class CoreGradesHelperProvider {
// Find href containing "/mod/xxx/xxx.php".
const regex = /href="([^"]*\/mod\/[^"|^/]*\/[^"|^.]*\.php[^"]*)/;
return await Promise.all(table.tabledata.filter((row) => {
return Promise.all(table.tabledata.filter((row) => {
if (row.itemname && row.itemname.content) {
const matches = row.itemname.content.match(regex);

View File

@ -108,7 +108,7 @@ export class CoreGradesProvider {
userId = userId || site.getUserId();
return await this.getCourseGradesItems(courseId, userId, groupId, siteId, ignoreCache);
return this.getCourseGradesItems(courseId, userId, groupId, siteId, ignoreCache);
}
/**

View File

@ -75,7 +75,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate<CoreTagAreaHandler>
async parseContent(component: string, itemType: string, content: string): Promise<unknown[] | undefined> {
const type = component + '/' + itemType;
return await this.executeFunctionOnEnabled(type, 'parseContent', [content]);
return this.executeFunctionOnEnabled(type, 'parseContent', [content]);
}
/**
@ -88,7 +88,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate<CoreTagAreaHandler>
async getComponent(component: string, itemType: string): Promise<Type<unknown> | undefined> {
const type = component + '/' + itemType;
return await this.executeFunctionOnEnabled(type, 'getComponent');
return this.executeFunctionOnEnabled(type, 'getComponent');
}
}

View File

@ -139,7 +139,7 @@ export class CoreUserProfileFieldDelegateService extends CoreDelegate<CoreUserPr
const name = 'profile_field_' + field.shortname;
if (handler.getData) {
return await handler.getData(field, signup, registerAuth, formValues);
return handler.getData(field, signup, registerAuth, formValues);
} else if (field.shortname && formValues[name] !== undefined) {
// Handler doesn't implement the function, but the form has data for the field.
return {

View File

@ -242,7 +242,7 @@ export class CoreLangProvider {
// Get current language from config (user might have changed it).
try {
return await CoreConfig.get<string>('current_language');
} catch (e) {
} catch {
// Try will return, ignore errors here to avoid nesting.
}

View File

@ -1260,7 +1260,7 @@ export class CoreSitesProvider {
async getSitesInstances(): Promise<CoreSite[]> {
const siteIds = await this.getSitesIds();
return await Promise.all(siteIds.map(async (siteId) => await this.getSite(siteId)));
return Promise.all(siteIds.map(async (siteId) => await this.getSite(siteId)));
}
/**
@ -1572,7 +1572,7 @@ export class CoreSitesProvider {
* @return Promise resolved with config if available.
*/
protected async getSiteConfig(site: CoreSite): Promise<CoreSiteConfig | undefined> {
return await site.getConfig(undefined, true);
return site.getConfig(undefined, true);
}
/**

View File

@ -100,7 +100,7 @@ export class CoreSyncProvider {
async getSyncRecord(component: string, id: string | number, siteId?: string): Promise<CoreSyncRecord> {
const db = await CoreSites.getSiteDb(siteId);
return await db.getRecord(SYNC_TABLE_NAME, { component: component, id: String(id) });
return db.getRecord(SYNC_TABLE_NAME, { component: component, id: String(id) });
}
/**

View File

@ -1782,7 +1782,7 @@ export class CoreDomUtilsProvider {
leaveAnimation: CoreModalLateralTransitionLeave,
}, options);
return await this.openModal<T>(options);
return this.openModal<T>(options);
}
/**

View File

@ -689,7 +689,7 @@ export class CoreUtilsProvider {
throw new Error('Countries not found.');
}
return await this.getCountryKeysListForLanguage(fallbackLang);
return this.getCountryKeysListForLanguage(fallbackLang);
}
}
@ -1611,7 +1611,7 @@ export class CoreUtilsProvider {
* @return Promise resolved with the captured text or undefined if cancelled or error.
*/
async scanQR(title?: string): Promise<string | undefined> {
return await CoreDomUtils.openModal<string>({
return CoreDomUtils.openModal<string>({
component: CoreViewerQRScannerComponent,
cssClass: 'core-modal-fullscreen',
componentProps: {