MOBILE-4081 chore: Prevent default on scroll controls
parent
421627e08e
commit
d356bf46fe
|
@ -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(
|
||||
|
|
|
@ -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 ||
|
||||
|
|
|
@ -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