MOBILE-2235 core: Fix site.getid() exceptions due to format text

main
Dani Palou 2019-11-07 11:41:19 +01:00
parent c4a58d9ee8
commit b9850b08dc
2 changed files with 7 additions and 4 deletions

View File

@ -51,7 +51,7 @@ export class CoreSitePickerComponent implements OnInit {
sites.forEach((site: any) => {
// Format the site name.
promises.push(this.filterProvider.formatText(site.siteName, {clean: true, singleLine: true, filter: false}, [],
site.getId()).catch(() => {
site.id).catch(() => {
return site.siteName;
}).then((siteName) => {
site.fullNameAndSiteName = this.translate.instant('core.fullnameandsitename',

View File

@ -404,7 +404,10 @@ export class CoreFormatTextDirective implements OnChanges {
// Error getting the site. This probably means that there is no current site and no siteId was supplied.
}).then((siteInstance: CoreSite) => {
site = siteInstance;
if (site) {
result.siteId = site.getId();
}
if (this.contextLevel == 'course' && this.contextInstanceId <= 0) {
this.contextInstanceId = site.getSiteHomeId();
@ -422,14 +425,14 @@ export class CoreFormatTextDirective implements OnChanges {
if (this.filter) {
return this.filterHelper.getFiltersAndFormatText(this.text, this.contextLevel, this.contextInstanceId,
result.options, site.getId()).then((res) => {
result.options, result.siteId).then((res) => {
result.filters = res.filters;
return res.text;
});
} else {
return this.filterProvider.formatText(this.text, result.options, [], site.getId());
return this.filterProvider.formatText(this.text, result.options, [], result.siteId);
}
}).then((formatted) => {