MOBILE-2235 core: Fix site.getid() exceptions due to format text
parent
c4a58d9ee8
commit
b9850b08dc
|
@ -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',
|
||||
|
|
|
@ -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;
|
||||
result.siteId = site.getId();
|
||||
|
||||
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) => {
|
||||
|
|
Loading…
Reference in New Issue