MOBILE-3626 core: Improve get current site home id

main
Pau Ferrer Ocaña 2020-12-17 14:42:22 +01:00
parent 9fec3807c2
commit 1958ce4b2b
8 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl
* Component being initialized. * Component being initialized.
*/ */
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
this.siteHomeId = CoreSites.instance.getCurrentSite()?.getSiteHomeId() || 1; this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId();
super.ngOnInit(); super.ngOnInit();
} }

View File

@ -16,7 +16,7 @@
<form (ngSubmit)="submitPassword($event)" #enrolPasswordForm> <form (ngSubmit)="submitPassword($event)" #enrolPasswordForm>
<ion-item> <ion-item>
<ion-label> <ion-label>
<core-show-password [name]="'password'"> <core-show-password name="password">
<ion-input <ion-input
class="ion-text-wrap core-ioninput-password" class="ion-text-wrap core-ioninput-password"
name="password" name="password"

View File

@ -46,7 +46,7 @@ export class CoreCoursesAvailableCoursesPage implements OnInit {
* @return Promise resolved when done. * @return Promise resolved when done.
*/ */
protected async loadCourses(): Promise<void> { protected async loadCourses(): Promise<void> {
const frontpageCourseId = CoreSites.instance.getCurrentSite()!.getSiteHomeId(); const frontpageCourseId = CoreSites.instance.getCurrentSiteHomeId();
try { try {
const courses = await CoreCourses.instance.getCoursesByField(); const courses = await CoreCourses.instance.getCoursesByField();

View File

@ -39,7 +39,7 @@
</ion-item> </ion-item>
<ion-item *ngIf="siteChecked && !isBrowserSSO" class="ion-margin-bottom"> <ion-item *ngIf="siteChecked && !isBrowserSSO" class="ion-margin-bottom">
<ion-label> <ion-label>
<core-show-password [name]="'password'"> <core-show-password name="password">
<ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}" <ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}"
formControlName="password" [clearOnEdit]="false" autocomplete="current-password" enterkeyhint="go" formControlName="password" [clearOnEdit]="false" autocomplete="current-password" enterkeyhint="go"
required="true"> required="true">

View File

@ -106,7 +106,7 @@
<ion-label position="stacked"> <ion-label position="stacked">
<span core-mark-required="true">{{ 'core.login.password' | translate }}</span> <span core-mark-required="true">{{ 'core.login.password' | translate }}</span>
</ion-label> </ion-label>
<core-show-password [name]="'password'"> <core-show-password name="password">
<ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}" <ion-input name="password" type="password" placeholder="{{ 'core.login.password' | translate }}"
formControlName="password" [clearOnEdit]="false" autocomplete="new-password" required="true"> formControlName="password" [clearOnEdit]="false" autocomplete="new-password" required="true">
</ion-input> </ion-input>

View File

@ -40,7 +40,7 @@
</ion-item> </ion-item>
<ion-item class="ion-margin-bottom"> <ion-item class="ion-margin-bottom">
<ion-label> <ion-label>
<core-show-password [name]="'password'"> <core-show-password name="password">
<ion-input class="core-ioninput-password" name="password" type="password" <ion-input class="core-ioninput-password" name="password" type="password"
placeholder="{{ 'core.login.password' | translate }}" formControlName="password" [clearOnEdit]="false" placeholder="{{ 'core.login.password' | translate }}" formControlName="password" [clearOnEdit]="false"
autocomplete="current-password" enterkeyhint="go" required="true"> autocomplete="current-password" enterkeyhint="go" required="true">

View File

@ -81,7 +81,7 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy {
}, CoreSites.instance.getCurrentSiteId()); }, CoreSites.instance.getCurrentSiteId());
this.currentSite = CoreSites.instance.getCurrentSite()!; this.currentSite = CoreSites.instance.getCurrentSite()!;
this.siteHomeId = this.currentSite?.getSiteHomeId() || 1; this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId();
const module = navParams['module']; const module = navParams['module'];
if (module) { if (module) {

View File

@ -47,7 +47,7 @@ export class CoreSiteHomeProvider {
*/ */
async getNewsForum(siteHomeId?: number): Promise<AddonModForumData> { async getNewsForum(siteHomeId?: number): Promise<AddonModForumData> {
if (!siteHomeId) { if (!siteHomeId) {
siteHomeId = CoreSites.instance.getCurrentSite()?.getSiteHomeId() || 1; siteHomeId = CoreSites.instance.getCurrentSiteHomeId();
} }
const forums = await AddonModForum.instance.getCourseForums(siteHomeId); const forums = await AddonModForum.instance.getCourseForums(siteHomeId);