MOBILE-3528 core: Fix handlers order if one hasn't priority
parent
8689ae76f6
commit
f63534109e
|
@ -86,14 +86,14 @@ export class CoreSortedDelegate<
|
|||
const handler = this.enabledHandlers[name];
|
||||
const data = <DisplayType> handler.getDisplayData();
|
||||
|
||||
data.priority = handler.priority;
|
||||
data.priority = handler.priority || 0;
|
||||
data.name = handler.name;
|
||||
|
||||
displayData.push(data);
|
||||
}
|
||||
|
||||
// Sort them by priority.
|
||||
displayData.sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
||||
displayData.sort((a, b) => b.priority! - a.priority!);
|
||||
|
||||
this.loaded = true;
|
||||
this.sortedHandlersRxJs.next(displayData);
|
||||
|
|
|
@ -450,7 +450,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate<CoreCourseOpt
|
|||
promises.push(Promise.resolve(getFunction!.call(handler, courseWithOptions)).then((data) => {
|
||||
handlersToDisplay.push({
|
||||
data: data,
|
||||
priority: handler.priority,
|
||||
priority: handler.priority || 0,
|
||||
prefetch: handler.prefetch && handler.prefetch.bind(handler),
|
||||
name: handler.name,
|
||||
});
|
||||
|
@ -467,7 +467,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate<CoreCourseOpt
|
|||
handlersToDisplay.sort((
|
||||
a: CoreCourseOptionsHandlerToDisplay | CoreCourseOptionsMenuHandlerToDisplay,
|
||||
b: CoreCourseOptionsHandlerToDisplay | CoreCourseOptionsMenuHandlerToDisplay,
|
||||
) => (b.priority || 0) - (a.priority || 0));
|
||||
) => b.priority! - a.priority!);
|
||||
|
||||
return handlersToDisplay;
|
||||
}
|
||||
|
|
|
@ -183,13 +183,13 @@ export class CoreFileUploaderDelegateService extends CoreDelegate<CoreFileUpload
|
|||
}
|
||||
|
||||
const data: CoreFileUploaderHandlerDataToReturn = handler.getData();
|
||||
data.priority = handler.priority;
|
||||
data.priority = handler.priority || 0;
|
||||
data.mimetypes = supportedMimetypes;
|
||||
handlers.push(data);
|
||||
}
|
||||
|
||||
// Sort them by priority.
|
||||
handlers.sort((a, b) => (a.priority || 0) <= (b.priority || 0) ? 1 : -1);
|
||||
handlers.sort((a, b) => a.priority! <= b.priority! ? 1 : -1);
|
||||
|
||||
return handlers;
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ export class CoreUserDelegateService extends CoreDelegate<CoreUserProfileHandler
|
|||
}));
|
||||
|
||||
// Sort them by priority.
|
||||
userData.handlers.sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
||||
userData.handlers.sort((a, b) => b.priority! - a.priority!);
|
||||
userData.loaded = true;
|
||||
userData.observable.next(userData.handlers);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue