commit
6c5984e263
|
@ -33,7 +33,7 @@ class Git {
|
|||
return new Promise((resolve, reject) => {
|
||||
exec(`git format-patch ${range} --stdout`, (err, result) => {
|
||||
if (err) {
|
||||
reject(err || 'Cannot create patch.');
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
39
gulp/jira.js
39
gulp/jira.js
|
@ -170,11 +170,11 @@ class Jira {
|
|||
return data;
|
||||
} catch (error) {
|
||||
// MDK not available or not configured. Ask for the data.
|
||||
const data = await this.askTrackerData();
|
||||
const trackerData = await this.askTrackerData();
|
||||
|
||||
data.fromInput = true;
|
||||
trackerData.fromInput = true;
|
||||
|
||||
return data;
|
||||
return trackerData;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,14 +208,14 @@ class Jira {
|
|||
return;
|
||||
}
|
||||
|
||||
exec('mdk config show tracker.username', (err, username) => {
|
||||
exec('mdk config show tracker.username', (error, username) => {
|
||||
if (username) {
|
||||
resolve({
|
||||
url: url.replace('\n', ''),
|
||||
username: username.replace('\n', ''),
|
||||
});
|
||||
} else {
|
||||
reject(err | 'Username not found.');
|
||||
reject(error || 'Username not found.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -234,7 +234,7 @@ class Jira {
|
|||
}
|
||||
|
||||
// Get tracker URL and username.
|
||||
const trackerData = await this.getTrackerData();
|
||||
let trackerData = await this.getTrackerData();
|
||||
|
||||
this.url = trackerData.url;
|
||||
this.username = trackerData.username;
|
||||
|
@ -316,15 +316,15 @@ class Jira {
|
|||
auth: `${this.username}:${this.password}`,
|
||||
headers: headers,
|
||||
};
|
||||
const request = https.request(url, options);
|
||||
const buildRequest = https.request(url, options);
|
||||
|
||||
// Add data.
|
||||
if (data) {
|
||||
request.write(data);
|
||||
buildRequest.write(data);
|
||||
}
|
||||
|
||||
// Treat response.
|
||||
request.on('response', (response) => {
|
||||
buildRequest.on('response', (response) => {
|
||||
// Read the result.
|
||||
let result = '';
|
||||
response.on('data', (chunk) => {
|
||||
|
@ -344,24 +344,24 @@ class Jira {
|
|||
});
|
||||
});
|
||||
|
||||
request.on('error', (e) => {
|
||||
buildRequest.on('error', (e) => {
|
||||
reject(e);
|
||||
});
|
||||
|
||||
// Send the request.
|
||||
request.end();
|
||||
buildRequest.end();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a set of fields for a certain issue in Jira.
|
||||
*
|
||||
* @param key Key to identify the issue. E.g. MOBILE-1234.
|
||||
* @param issueId Key to identify the issue. E.g. MOBILE-1234.
|
||||
* @param updates Object with the fields to update.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
async setCustomFields(key, updates) {
|
||||
const issue = await this.getIssue(key);
|
||||
async setCustomFields(issueId, updates) {
|
||||
const issue = await this.getIssue(issueId);
|
||||
const update = {'fields': {}};
|
||||
|
||||
// Detect which fields have changed.
|
||||
|
@ -372,9 +372,10 @@ class Jira {
|
|||
if (!remoteValue || remoteValue != updateValue) {
|
||||
// Map the label of the field with the field code.
|
||||
let fieldKey;
|
||||
for (const key in issue.names) {
|
||||
if (issue.names[key] == updateName) {
|
||||
fieldKey = key;
|
||||
|
||||
for (const id in issue.names) {
|
||||
if (issue.names[id] == updateName) {
|
||||
fieldKey = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ class Jira {
|
|||
headers = headers || {};
|
||||
headers['Content-Type'] = 'multipart/form-data';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
// Add the file to the form data.
|
||||
const formData = {};
|
||||
formData[fieldName] = {
|
||||
|
@ -462,7 +463,7 @@ class Jira {
|
|||
formData: formData,
|
||||
};
|
||||
|
||||
request(options, (err, httpResponse, body) => {
|
||||
request(options, (_err, httpResponse, body) => {
|
||||
resolve({
|
||||
status: httpResponse.statusCode,
|
||||
data: body,
|
||||
|
|
|
@ -144,11 +144,10 @@ class BuildLangTask {
|
|||
|
||||
switch (folders[0]) {
|
||||
case 'core':
|
||||
switch (folders[1]) {
|
||||
case 'features':
|
||||
return `core.${folders[2]}.`;
|
||||
default:
|
||||
return 'core.';
|
||||
if (folders[1] == 'features') {
|
||||
return `core.${folders[2]}.`;
|
||||
} else {
|
||||
return 'core.';
|
||||
}
|
||||
case 'addons':
|
||||
return `addon.${folders.slice(1).join('_')}.`;
|
||||
|
|
|
@ -58,22 +58,23 @@ class Utils {
|
|||
*/
|
||||
static getCommandLineArguments() {
|
||||
|
||||
let args = {}, opt, thisOpt, curOpt;
|
||||
for (let a = 0; a < process.argv.length; a++) {
|
||||
let args = {};
|
||||
let curOpt;
|
||||
|
||||
thisOpt = process.argv[a].trim();
|
||||
opt = thisOpt.replace(/^\-+/, '');
|
||||
for (const argument of process.argv) {
|
||||
const thisOpt = argument.trim();
|
||||
const option = thisOpt.replace(/^\-+/, '');
|
||||
|
||||
if (opt === thisOpt) {
|
||||
if (option === thisOpt) {
|
||||
// argument value
|
||||
if (curOpt) {
|
||||
args[curOpt] = opt;
|
||||
args[curOpt] = option;
|
||||
}
|
||||
curOpt = null;
|
||||
}
|
||||
else {
|
||||
// Argument name.
|
||||
curOpt = opt;
|
||||
curOpt = option;
|
||||
args[curOpt] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ class behat_app extends behat_app_helper {
|
|||
|
||||
// Wait until the main page appears.
|
||||
$this->spin(
|
||||
function($context, $args) {
|
||||
function($context) {
|
||||
$initialpage = $context->getSession()->getPage()->find('xpath', '//page-core-mainmenu') ??
|
||||
$context->getSession()->getPage()->find('xpath', '//page-core-login-change-password') ??
|
||||
$context->getSession()->getPage()->find('xpath', '//page-core-user-complete-profile');
|
||||
|
@ -780,7 +780,7 @@ class behat_app extends behat_app_helper {
|
|||
if (!is_null($urlpattern)) {
|
||||
$this->getSession()->switchToWindow($windowNames[1]);
|
||||
$windowurl = $this->getSession()->getCurrentUrl();
|
||||
$windowhaspattern = !!preg_match("/$urlpattern/", $windowurl);
|
||||
$windowhaspattern = (bool)preg_match("/$urlpattern/", $windowurl);
|
||||
$this->getSession()->switchToWindow($windowNames[0]);
|
||||
|
||||
if ($not === $windowhaspattern) {
|
||||
|
@ -885,6 +885,8 @@ class behat_app extends behat_app_helper {
|
|||
case 'offline':
|
||||
$this->runtime_js("network.setForceConnectionMode('none');");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -412,12 +412,9 @@ class behat_app_helper extends behat_base {
|
|||
preg_match_all("/\\$\\{([^:}]+):([^}]+)\\}/", $text, $matches);
|
||||
|
||||
foreach ($matches[0] as $index => $match) {
|
||||
switch ($matches[2][$index]) {
|
||||
case 'cmid':
|
||||
$coursemodule = $DB->get_record('course_modules', ['idnumber' => $matches[1][$index]]);
|
||||
$text = str_replace($match, $coursemodule->id, $text);
|
||||
|
||||
break;
|
||||
if ($matches[2][$index] == 'cmid') {
|
||||
$coursemodule = $DB->get_record('course_modules', ['idnumber' => $matches[1][$index]]);
|
||||
$text = str_replace($match, $coursemodule->id, $text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +547,7 @@ class behat_app_helper extends behat_base {
|
|||
if (!empty($successXPath)) {
|
||||
// Wait until the page appears.
|
||||
$this->spin(
|
||||
function($context, $args) use ($successXPath) {
|
||||
function($context) use ($successXPath) {
|
||||
$found = $context->getSession()->getPage()->find('xpath', $successXPath);
|
||||
if ($found) {
|
||||
return true;
|
||||
|
@ -597,7 +594,6 @@ class behat_app_helper extends behat_base {
|
|||
$cmfrom = $cmtable->get_from_sql();
|
||||
|
||||
$acttable = new \core\dml\table($activity, 'a', 'a');
|
||||
$actselect = $acttable->get_field_select();
|
||||
$actfrom = $acttable->get_from_sql();
|
||||
|
||||
$sql = <<<EOF
|
||||
|
@ -662,7 +658,7 @@ EOF;
|
|||
// Set up relevant tags for each version.
|
||||
$usedtags = array_keys($usedtags);
|
||||
foreach ($usedtags as $usedtag) {
|
||||
if (!preg_match('~^lms_(from|upto)([0-9]+(?:\.[0-9]+)*)$~', $usedtag, $matches)) {
|
||||
if (!preg_match('~^lms_(from|upto)(\d+(?:\.\d+)*)$~', $usedtag, $matches)) {
|
||||
// No match, ignore.
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -78,10 +78,8 @@ class behat_performance extends behat_base {
|
|||
$spaceindex = strpos($text, ' ');
|
||||
$value = floatval(substr($text, 0, $spaceindex));
|
||||
|
||||
switch (substr($text, $spaceindex + 1)) {
|
||||
case 'seconds':
|
||||
$value *= 1000;
|
||||
break;
|
||||
if (substr($text, $spaceindex + 1) == 'seconds') {
|
||||
$value *= 1000;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
@ -108,6 +106,8 @@ class behat_performance extends behat_base {
|
|||
return function ($a, $b) {
|
||||
return $a === $b;
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,13 +247,13 @@ class performance_measure implements behat_app_listener {
|
|||
* Analyse long tasks.
|
||||
*/
|
||||
private function analyseLongTasks(): void {
|
||||
$blocking = 0;
|
||||
$blockingDuration = 0;
|
||||
|
||||
foreach ($this->longTasks as $longTask) {
|
||||
$blocking += $longTask['duration'] - 50;
|
||||
$blockingDuration += $longTask['duration'] - 50;
|
||||
}
|
||||
|
||||
$this->blocking = $blocking;
|
||||
$this->blocking = $blockingDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,15 +269,15 @@ class performance_measure implements behat_app_listener {
|
|||
private function analysePerformanceLogs(): void {
|
||||
global $CFG;
|
||||
|
||||
$scripting = 0;
|
||||
$styling = 0;
|
||||
$networking = 0;
|
||||
$scriptingDuration = 0;
|
||||
$stylingDuration = 0;
|
||||
$networkingCount = 0;
|
||||
$logs = $this->getPerformanceLogs();
|
||||
|
||||
foreach ($logs as $log) {
|
||||
// TODO this should filter by end time as well, but it seems like the timestamps are not
|
||||
// working as expected.
|
||||
if (($log['timestamp'] < $this->start)) {
|
||||
if ($log['timestamp'] < $this->start) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -285,27 +285,27 @@ class performance_measure implements behat_app_listener {
|
|||
$messagename = $message->params->name ?? '';
|
||||
|
||||
if (in_array($messagename, ['FunctionCall', 'GCEvent', 'MajorGC', 'MinorGC', 'EvaluateScript'])) {
|
||||
$scripting += $message->params->dur;
|
||||
$scriptingDuration += $message->params->dur;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($messagename, ['UpdateLayoutTree', 'RecalculateStyles', 'ParseAuthorStyleSheet'])) {
|
||||
$styling += $message->params->dur;
|
||||
$stylingDuration += $message->params->dur;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($messagename, ['XHRLoad']) && !str_starts_with($message->params->args->data->url, $CFG->behat_ionic_wwwroot)) {
|
||||
$networking++;
|
||||
$networkingCount++;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->scripting = round($scripting / 1000);
|
||||
$this->styling = round($styling / 1000);
|
||||
$this->networking = $networking;
|
||||
$this->scripting = round($scriptingDuration / 1000);
|
||||
$this->styling = round($stylingDuration / 1000);
|
||||
$this->networking = $networkingCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,7 +93,7 @@ async function main() {
|
|||
}
|
||||
|
||||
const newPath = featurePath.substring(0, featurePath.length - ('/tests/behat'.length));
|
||||
const searchRegExp = new RegExp('/', 'g');
|
||||
const searchRegExp = /\//g;
|
||||
const prefix = relative(behatTempFeaturesPath, newPath).replace(searchRegExp,'-') || 'core';
|
||||
const featureFilename = prefix + '-' + basename(featureFile);
|
||||
renameSync(featureFile, behatFeaturesPath + '/' + featureFilename);
|
||||
|
|
|
@ -42,7 +42,7 @@ $versions = array('master', '310', '39', '38', '37', '36', '35', '34', '33', '32
|
|||
|
||||
$moodlespath = $argv[1];
|
||||
$wsname = $argv[2];
|
||||
$useparams = !!(isset($argv[3]) && $argv[3]);
|
||||
$useparams = (bool)(isset($argv[3]) && $argv[3]);
|
||||
$pathseparator = '/';
|
||||
|
||||
// Get the path to the script.
|
||||
|
|
|
@ -39,7 +39,7 @@ if (!defined('SERIALIZED')) {
|
|||
|
||||
$moodlepath = $argv[1];
|
||||
$wsname = $argv[2];
|
||||
$useparams = !!(isset($argv[3]) && $argv[3]);
|
||||
$useparams = (bool)(isset($argv[3]) && $argv[3]);
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ function build_lang($lang) {
|
|||
$text = str_replace(['{{{', '}}}'], ['{{', '}}'], $text);
|
||||
} else {
|
||||
// @TODO: Remove that line when core.cannotconnect and core.login.invalidmoodleversion are completelly changed to use $a
|
||||
if (($appkey == 'core.cannotconnect' || $appkey == 'core.login.invalidmoodleversion') && strpos($text, '2.4') != false) {
|
||||
if (($appkey == 'core.cannotconnect' || $appkey == 'core.login.invalidmoodleversion') && strpos($text, '2.4')) {
|
||||
$text = str_replace('2.4', '{{$a}}', $text);
|
||||
}
|
||||
$local++;
|
||||
|
@ -471,13 +471,10 @@ function override_component_lang_files($translations) {
|
|||
}
|
||||
switch($type) {
|
||||
case 'core':
|
||||
switch($component) {
|
||||
case 'moodle':
|
||||
$path .= 'core/lang.json';
|
||||
break;
|
||||
default:
|
||||
$path .= 'core/features/'.str_replace('_', '/', $component).'/lang.json';
|
||||
break;
|
||||
if ($component == 'moodle') {
|
||||
$path .= 'core/lang.json';
|
||||
} else {
|
||||
$path .= 'core/features/'.str_replace('_', '/', $component).'/lang.json';
|
||||
}
|
||||
break;
|
||||
case 'addon':
|
||||
|
|
|
@ -70,7 +70,7 @@ function fix_comment($desc) {
|
|||
if (count($lines) > 1) {
|
||||
$desc = array_shift($lines)."\n";
|
||||
|
||||
foreach ($lines as $i => $line) {
|
||||
foreach ($lines as $line) {
|
||||
$spaces = strlen($line) - strlen(ltrim($line));
|
||||
$desc .= str_repeat(' ', $spaces - 3) . '// '. ltrim($line)."\n";
|
||||
}
|
||||
|
@ -138,9 +138,7 @@ function convert_to_ts($key, $value, $boolisnumber = false, $indentation = '', $
|
|||
$type = 'number';
|
||||
}
|
||||
|
||||
$result = convert_key_type($key, $type, $value->required, $indentation);
|
||||
|
||||
return $result;
|
||||
return convert_key_type($key, $type, $value->required, $indentation);
|
||||
|
||||
} else if ($value instanceof external_single_structure) {
|
||||
// It's an object.
|
||||
|
@ -278,7 +276,7 @@ function remove_default_closures($value) {
|
|||
|
||||
} else if ($value instanceof external_single_structure) {
|
||||
|
||||
foreach ($value->keys as $key => $subvalue) {
|
||||
foreach ($value->keys as $subvalue) {
|
||||
remove_default_closures($subvalue);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -389,7 +389,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
return;
|
||||
}
|
||||
|
||||
return await AddonModAssignSync.syncAssign(this.assign.id);
|
||||
return AddonModAssignSync.syncAssign(this.assign.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -103,7 +103,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
num: number;
|
||||
max: number;
|
||||
reseturl: string;
|
||||
};;
|
||||
};
|
||||
|
||||
hasOfflineRatings = false;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -126,6 +126,8 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
return;
|
||||
}
|
||||
|
||||
syncedDiscussionIds.push(reply.discussionid);
|
||||
|
||||
const result = force
|
||||
? await this.syncDiscussionReplies(reply.discussionid, reply.userid, siteId)
|
||||
: await this.syncDiscussionRepliesIfNeeded(reply.discussionid, reply.userid, siteId);
|
||||
|
|
|
@ -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)),
|
||||
);
|
||||
}));
|
||||
|
|
|
@ -673,7 +673,7 @@ export class AddonModGlossaryProvider {
|
|||
* @return Promise resolved with all entrries.
|
||||
*/
|
||||
fetchAllEntries(
|
||||
fetchFunction: (options?: AddonModGlossaryGetEntriesOptions) => AddonModGlossaryGetEntriesWSResponse,
|
||||
fetchFunction: (options?: AddonModGlossaryGetEntriesOptions) => Promise<AddonModGlossaryGetEntriesWSResponse>,
|
||||
options: CoreCourseCommonModWSOptions = {},
|
||||
): Promise<AddonModGlossaryEntry[]> {
|
||||
options.siteId = options.siteId || CoreSites.getCurrentSiteId();
|
||||
|
@ -681,7 +681,7 @@ export class AddonModGlossaryProvider {
|
|||
const entries: AddonModGlossaryEntry[] = [];
|
||||
|
||||
const fetchMoreEntries = async (): Promise<AddonModGlossaryEntry[]> => {
|
||||
const result = fetchFunction({
|
||||
const result = await fetchFunction({
|
||||
from: entries.length,
|
||||
...options, // Include all options.
|
||||
});
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -214,7 +214,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
// Update the view.
|
||||
prefetched ?
|
||||
this.showLoadingAndFetch(false, false) :
|
||||
this.showLoadingAndRefresh(false);;
|
||||
this.showLoadingAndRefresh(false);
|
||||
} catch {
|
||||
// Prefetch failed, refresh the data.
|
||||
this.showLoadingAndRefresh(false);
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,7 +177,7 @@ export class AddonNotesProvider {
|
|||
throw error;
|
||||
}
|
||||
|
||||
return await storeOffline();
|
||||
return storeOffline();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,7 +96,7 @@ export class AddonReportInsightsActionLinkHandlerService extends CoreContentLink
|
|||
return false;
|
||||
}
|
||||
|
||||
return await AddonReportInsights.canSendActionInSite(siteId);
|
||||
return AddonReportInsights.canSendActionInSite(siteId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ const MOODLEAPP_VERSION_PREFIX = 'moodleapp-';
|
|||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: 'app.component.html',
|
||||
styleUrls: ['app.component.scss'],
|
||||
})
|
||||
export class AppComponent implements OnInit, AfterViewInit {
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
// limitations under the License.
|
||||
|
||||
(function () {
|
||||
var url = location.href;
|
||||
const locationHref = location.href;
|
||||
|
||||
if (url.match(/^moodleappfs:\/\/localhost/i) || !url.match(/^[a-z0-9]+:\/\//i)) {
|
||||
if (locationHref.match(/^moodleappfs:\/\/localhost/i) || !locationHref.match(/^[a-z0-9]+:\/\//i)) {
|
||||
// Same domain as the app, stop.
|
||||
return;
|
||||
}
|
||||
|
@ -41,14 +41,14 @@
|
|||
};
|
||||
|
||||
// Handle link clicks.
|
||||
document.addEventListener('click', (event) => {
|
||||
if (event.defaultPrevented) {
|
||||
document.addEventListener('click', (documentClickEvent) => {
|
||||
if (documentClickEvent.defaultPrevented) {
|
||||
// Event already prevented by some other code.
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the link being clicked.
|
||||
var el = event.target;
|
||||
let el = documentClickEvent.target;
|
||||
while (el && (el.tagName !== 'A' && el.tagName !== 'a')) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
|
@ -59,8 +59,8 @@
|
|||
|
||||
// Add click listener to the link, this way if the iframe has added a listener to the link it will be executed first.
|
||||
el.treated = true;
|
||||
el.addEventListener('click', function(event) {
|
||||
linkClicked(el, event);
|
||||
el.addEventListener('click', function(elementClickEvent) {
|
||||
linkClicked(el, elementClickEvent);
|
||||
});
|
||||
}, {
|
||||
capture: true // Use capture to fix this listener not called if the element clicked is too deep in the DOM.
|
||||
|
@ -82,8 +82,8 @@
|
|||
return leftPath;
|
||||
}
|
||||
|
||||
var lastCharLeft = leftPath.slice(-1);
|
||||
var firstCharRight = rightPath.charAt(0);
|
||||
const lastCharLeft = leftPath.slice(-1);
|
||||
const firstCharRight = rightPath.charAt(0);
|
||||
|
||||
if (lastCharLeft === '/' && firstCharRight === '/') {
|
||||
return leftPath + rightPath.substr(1);
|
||||
|
@ -119,7 +119,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var matches = url.match(/^([a-z][a-z0-9+\-.]*):/);
|
||||
const matches = url.match(/^([a-z][a-z0-9+\-.]*):/);
|
||||
if (matches && matches[1]) {
|
||||
return matches[1];
|
||||
}
|
||||
|
@ -164,9 +164,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var linkScheme = getUrlScheme(link.href);
|
||||
var pageScheme = getUrlScheme(location.href);
|
||||
var isTargetSelf = !link.target || link.target == '_self';
|
||||
const linkScheme = getUrlScheme(link.href);
|
||||
const pageScheme = getUrlScheme(location.href);
|
||||
const isTargetSelf = !link.target || link.target == '_self';
|
||||
|
||||
if (!link.href || linkScheme == 'javascript') {
|
||||
// Links with no URL and Javascript links are ignored.
|
||||
|
@ -207,7 +207,7 @@
|
|||
}
|
||||
|
||||
// It's a relative URL, use the frame src to create the full URL.
|
||||
var pathToDir = location.href.substring(0, location.href.lastIndexOf('/'));
|
||||
const pathToDir = location.href.substring(0, location.href.lastIndexOf('/'));
|
||||
|
||||
return concatenatePaths(pathToDir, url);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -301,7 +301,7 @@ export class CoreContentLinksDelegateService {
|
|||
return true;
|
||||
}
|
||||
|
||||
return await handler.isEnabled(siteId, url, params, courseId);
|
||||
return handler.isEnabled(siteId, url, params, courseId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
|
|||
|
||||
removeFilesLoading = false;
|
||||
prefetchLoading = false;
|
||||
canPrefetch = false;;
|
||||
canPrefetch = false;
|
||||
prefetchDisabled = false;
|
||||
size?: number; // Size in bytes
|
||||
downloadTimeReadable = ''; // Last download time in a readable format.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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' },
|
||||
],
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<core-empty-box *ngIf="rows && rows.length === 0" icon="fas-chart-bar" [message]="'core.grades.nogradesreturned' | translate">
|
||||
</core-empty-box>
|
||||
<div *ngIf="rows && rows.length > 0" class="core-grades-container">
|
||||
<table cellspacing="0" cellpadding="0" class="core-grades-table" [class.summary]="showSummary">
|
||||
<table class="core-grades-table" [class.summary]="showSummary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngFor="let column of columns" id="{{column.name}}" class="ion-text-start"
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1782,7 +1782,7 @@ export class CoreDomUtilsProvider {
|
|||
leaveAnimation: CoreModalLateralTransitionLeave,
|
||||
}, options);
|
||||
|
||||
return await this.openModal<T>(options);
|
||||
return this.openModal<T>(options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -175,7 +175,7 @@ export class CoreDom {
|
|||
slot.removeEventListener('slotchange', slotListener);
|
||||
};
|
||||
|
||||
slot.addEventListener('slotchange', slotListener);;
|
||||
slot.addEventListener('slotchange', slotListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue