commit
6fb5657869
|
@ -1,9 +1,9 @@
|
|||
<ion-button fill="clear" (click)="scroll('backward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'start'"
|
||||
<ion-button fill="clear" (click)="scroll($event, 'backward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'start'"
|
||||
[attr.aria-label]="'core.scrollbackward' | translate" [attr.aria-controls]="targetId">
|
||||
<ion-icon name="fas-chevron-left" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
||||
</ion-button>
|
||||
|
||||
<ion-button fill="clear" (click)="scroll('forward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'end'"
|
||||
<ion-button fill="clear" (click)="scroll($event, 'forward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'end'"
|
||||
[attr.aria-label]="'core.scrollforward' | translate" [attr.aria-controls]="targetId">
|
||||
<ion-icon name="fas-chevron-right" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
||||
</ion-button>
|
||||
|
|
|
@ -44,13 +44,17 @@ export class CoreHorizontalScrollControlsComponent {
|
|||
/**
|
||||
* Scroll the target in the given direction.
|
||||
*
|
||||
* @param ev Click event
|
||||
* @param direction Scroll direction.
|
||||
*/
|
||||
scroll(direction: 'forward' | 'backward'): void {
|
||||
scroll(ev: Event, direction: 'forward' | 'backward'): void {
|
||||
if (!this.target) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
const leftDelta = direction === 'forward' ? this.target.clientWidth : -this.target.clientWidth;
|
||||
const newScrollLeft = Math.max(
|
||||
Math.min(
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content [fullscreen]="true">
|
||||
<ion-content>
|
||||
<ion-refresher slot="fixed" [disabled]="!dataLoaded" (ionRefresh)="refreshData($event.target)">
|
||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||
</ion-refresher>
|
||||
|
|
|
@ -163,8 +163,6 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
|
|||
|
||||
/**
|
||||
* Open a course.
|
||||
*
|
||||
* @param course The course to open.
|
||||
*/
|
||||
openCourse(): void {
|
||||
if (this.isEnrolled) {
|
||||
|
@ -179,6 +177,8 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
|
|||
|
||||
/**
|
||||
* Initialize prefetch course.
|
||||
*
|
||||
* @param forceInit Force initialization of prefetch course info.
|
||||
*/
|
||||
async initPrefetchCourse(forceInit = false): Promise<void> {
|
||||
if (!this.isEnrolled || !this.showDownload ||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</ion-refresher>
|
||||
|
||||
<core-loading [hideUntil]="loaded">
|
||||
<ion-list class="list-item-limited-width">
|
||||
<ion-list class="list-item-limited-width" *ngIf="hasMainBlocks">
|
||||
<ng-container *ngFor="let block of blocks">
|
||||
<core-block *ngIf="block.visible" [block]="block" contextLevel="user" [instanceId]="userId"></core-block>
|
||||
</ng-container>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<core-block-side-blocks-button slot="fixed" *ngIf="hasSideBlocks" contextLevel="user" [instanceId]="userId">
|
||||
</core-block-side-blocks-button>
|
||||
|
||||
<core-empty-box *ngIf="blocks.length == 0" icon="fas-cubes" [message]="'core.course.nocontentavailable' | translate">
|
||||
<core-empty-box *ngIf="!hasMainBlocks" icon="fas-cubes" [message]="'core.course.nocontentavailable' | translate">
|
||||
</core-empty-box>
|
||||
</core-loading>
|
||||
</ion-content>
|
||||
|
|
|
@ -36,6 +36,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
|
|||
|
||||
@ViewChildren(CoreBlockComponent) blocksComponents?: QueryList<CoreBlockComponent>;
|
||||
|
||||
hasMainBlocks = false;
|
||||
hasSideBlocks = false;
|
||||
searchEnabled = false;
|
||||
downloadCourseEnabled = false;
|
||||
|
@ -84,6 +85,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
|
|||
|
||||
this.blocks = blocks.mainBlocks;
|
||||
|
||||
this.hasMainBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.mainBlocks);
|
||||
this.hasSideBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);
|
||||
} catch (error) {
|
||||
CoreDomUtils.showErrorModal(error);
|
||||
|
|
|
@ -137,11 +137,11 @@ export class CoreUserProvider {
|
|||
|
||||
const result = await site.write<CoreUserUpdatePictureWSResponse>('core_user_update_picture', params);
|
||||
|
||||
if (!result.success) {
|
||||
if (!result.success || !result.profileimageurl) {
|
||||
return Promise.reject(null);
|
||||
}
|
||||
|
||||
return result.profileimageurl!;
|
||||
return result.profileimageurl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -452,7 +452,7 @@ export class CoreUserProvider {
|
|||
name,
|
||||
};
|
||||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getUserPreferenceCacheKey(params.name!),
|
||||
cacheKey: this.getUserPreferenceCacheKey(name),
|
||||
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
||||
};
|
||||
|
||||
|
@ -613,7 +613,7 @@ export class CoreUserProvider {
|
|||
const treated: Record<string, boolean> = {};
|
||||
|
||||
await Promise.all(userIds.map(async (userId) => {
|
||||
if (userId === null) {
|
||||
if (userId === null || !siteId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ export class CoreUserProvider {
|
|||
const profile = await this.getProfile(userId, courseId, false, siteId);
|
||||
|
||||
if (profile.profileimageurl) {
|
||||
await CoreFilepool.addToQueueByUrl(siteId!, profile.profileimageurl);
|
||||
await CoreFilepool.addToQueueByUrl(siteId, profile.profileimageurl);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.warn(`Ignore error when prefetching user ${userId}`, error);
|
||||
|
@ -658,7 +658,7 @@ export class CoreUserProvider {
|
|||
const promises = entries.map(async (entry) => {
|
||||
const imageUrl = <string> entry[propertyName];
|
||||
|
||||
if (!imageUrl || treated[imageUrl]) {
|
||||
if (!imageUrl || treated[imageUrl] || !siteId) {
|
||||
// It doesn't have an image or it has already been treated.
|
||||
return;
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ export class CoreUserProvider {
|
|||
treated[imageUrl] = true;
|
||||
|
||||
try {
|
||||
await CoreFilepool.addToQueueByUrl(siteId!, imageUrl);
|
||||
await CoreFilepool.addToQueueByUrl(siteId, imageUrl);
|
||||
} catch (ex) {
|
||||
this.logger.warn(`Ignore error when prefetching user avatar ${imageUrl}`, entry, ex);
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ export class CoreUserProvider {
|
|||
* @param search The string to search.
|
||||
* @param searchAnywhere Whether to find a match anywhere or only at the beginning.
|
||||
* @param page Page to get.
|
||||
* @param limitNumber Number of participants to get.
|
||||
* @param perPage Number of participants to get.
|
||||
* @param siteId Site Id. If not defined, use current site.
|
||||
* @return Promise resolved when the participants are retrieved.
|
||||
* @since 3.8
|
||||
|
|
Loading…
Reference in New Issue