MOBILE-3708 core: Always remove empty params in navigator
This commit is contained in:
		
							parent
							
								
									65d097b498
								
							
						
					
					
						commit
						200b01eef6
					
				@ -22,7 +22,6 @@ import { CoreUtils } from '@services/utils/utils';
 | 
				
			|||||||
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
 | 
					import { CorePageItemsListManager } from '@classes/page-items-list-manager';
 | 
				
			||||||
import { ActivatedRoute, ActivatedRouteSnapshot, Params } from '@angular/router';
 | 
					import { ActivatedRoute, ActivatedRouteSnapshot, Params } from '@angular/router';
 | 
				
			||||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
					import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Page that displays the list of calendar events.
 | 
					 * Page that displays the list of calendar events.
 | 
				
			||||||
@ -125,10 +124,10 @@ class AddonBadgesUserBadgesManager extends CorePageItemsListManager<AddonBadgesU
 | 
				
			|||||||
     * @inheritdoc
 | 
					     * @inheritdoc
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected getItemQueryParams(): Params {
 | 
					    protected getItemQueryParams(): Params {
 | 
				
			||||||
        return CoreObject.withoutEmpty({
 | 
					        return {
 | 
				
			||||||
            courseId: this.courseId,
 | 
					            courseId: this.courseId,
 | 
				
			||||||
            userId: this.userId,
 | 
					            userId: this.userId,
 | 
				
			||||||
        });
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,6 @@ import { CoreUserProfile } from '@features/user/services/user';
 | 
				
			|||||||
import { CoreUserDelegateService, CoreUserProfileHandler, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
 | 
					import { CoreUserDelegateService, CoreUserProfileHandler, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
 | 
				
			||||||
import { CoreNavigator } from '@services/navigator';
 | 
					import { CoreNavigator } from '@services/navigator';
 | 
				
			||||||
import { makeSingleton } from '@singletons';
 | 
					import { makeSingleton } from '@singletons';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
import { AddonBadges } from '../badges';
 | 
					import { AddonBadges } from '../badges';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -74,7 +73,7 @@ export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
 | 
				
			|||||||
                event.preventDefault();
 | 
					                event.preventDefault();
 | 
				
			||||||
                event.stopPropagation();
 | 
					                event.stopPropagation();
 | 
				
			||||||
                CoreNavigator.navigateToSitePath('/badges', {
 | 
					                CoreNavigator.navigateToSitePath('/badges', {
 | 
				
			||||||
                    params: CoreObject.withoutEmpty({ courseId, userId: user.id }),
 | 
					                    params: { courseId, userId: user.id },
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,6 @@ import { CoreDomUtils } from '@services/utils/dom';
 | 
				
			|||||||
import { CoreUtils } from '@services/utils/utils';
 | 
					import { CoreUtils } from '@services/utils/utils';
 | 
				
			||||||
import { Translate } from '@singletons';
 | 
					import { Translate } from '@singletons';
 | 
				
			||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
					import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    AddonModAssignAssign,
 | 
					    AddonModAssignAssign,
 | 
				
			||||||
    AddonModAssignSubmission,
 | 
					    AddonModAssignSubmission,
 | 
				
			||||||
@ -368,9 +367,9 @@ class AddonModAssignSubmissionListManager extends CorePageItemsListManager<Addon
 | 
				
			|||||||
     * @inheritdoc
 | 
					     * @inheritdoc
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected getItemQueryParams(submission: AddonModAssignSubmissionForList): Params {
 | 
					    protected getItemQueryParams(submission: AddonModAssignSubmissionForList): Params {
 | 
				
			||||||
        return CoreObject.withoutEmpty({
 | 
					        return {
 | 
				
			||||||
            blindId: submission.blindid,
 | 
					            blindId: submission.blindid,
 | 
				
			||||||
        });
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -15,8 +15,6 @@
 | 
				
			|||||||
import { Directive, Input, OnInit, ElementRef } from '@angular/core';
 | 
					import { Directive, Input, OnInit, ElementRef } from '@angular/core';
 | 
				
			||||||
import { CoreNavigator } from '@services/navigator';
 | 
					import { CoreNavigator } from '@services/navigator';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Directive to go to user profile on click.
 | 
					 * Directive to go to user profile on click.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -50,10 +48,10 @@ export class CoreUserLinkDirective implements OnInit {
 | 
				
			|||||||
            event.stopPropagation();
 | 
					            event.stopPropagation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            CoreNavigator.navigateToSitePath('user', {
 | 
					            CoreNavigator.navigateToSitePath('user', {
 | 
				
			||||||
                params: CoreObject.withoutEmpty({
 | 
					                params: {
 | 
				
			||||||
                    userId: this.userId,
 | 
					                    userId: this.userId,
 | 
				
			||||||
                    courseId: this.courseId,
 | 
					                    courseId: this.courseId,
 | 
				
			||||||
                }),
 | 
					                },
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,6 @@ import {
 | 
				
			|||||||
import { CoreSites } from '@services/sites';
 | 
					import { CoreSites } from '@services/sites';
 | 
				
			||||||
import { CoreUtils } from '@services/utils/utils';
 | 
					import { CoreUtils } from '@services/utils/utils';
 | 
				
			||||||
import { CoreSplitViewComponent, CoreSplitViewMode } from '@components/split-view/split-view';
 | 
					import { CoreSplitViewComponent, CoreSplitViewMode } from '@components/split-view/split-view';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
 | 
					import { CorePageItemsListManager } from '@classes/page-items-list-manager';
 | 
				
			||||||
import { CoreNavigator } from '@services/navigator';
 | 
					import { CoreNavigator } from '@services/navigator';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -174,7 +173,7 @@ class CoreGradesCourseManager extends CorePageItemsListManager<CoreGradesFormatt
 | 
				
			|||||||
     * @inheritdoc
 | 
					     * @inheritdoc
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected getItemQueryParams(): Params {
 | 
					    protected getItemQueryParams(): Params {
 | 
				
			||||||
        return CoreObject.withoutEmpty({ userId: this.userId });
 | 
					        return { userId: this.userId };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,6 @@ import { makeSingleton, Translate } from '@singletons';
 | 
				
			|||||||
import { CoreLogger } from '@singletons/logger';
 | 
					import { CoreLogger } from '@singletons/logger';
 | 
				
			||||||
import { CoreUrl } from '@singletons/url';
 | 
					import { CoreUrl } from '@singletons/url';
 | 
				
			||||||
import { CoreNavigator } from '@services/navigator';
 | 
					import { CoreNavigator } from '@services/navigator';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Helper provider that provides some common features regarding authentication.
 | 
					 * Helper provider that provides some common features regarding authentication.
 | 
				
			||||||
@ -428,7 +427,7 @@ export class CoreLoginHelperProvider {
 | 
				
			|||||||
            return ['/login/credentials', { siteUrl: url }];
 | 
					            return ['/login/credentials', { siteUrl: url }];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return ['/login/site', CoreObject.withoutEmpty({ showKeyboard: showKeyboard })];
 | 
					        return ['/login/site', { showKeyboard }];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,6 @@ import { CanActivate, CanLoad, UrlTree } from '@angular/router';
 | 
				
			|||||||
import { CoreApp } from '@services/app';
 | 
					import { CoreApp } from '@services/app';
 | 
				
			||||||
import { CoreSites } from '@services/sites';
 | 
					import { CoreSites } from '@services/sites';
 | 
				
			||||||
import { Router } from '@singletons';
 | 
					import { Router } from '@singletons';
 | 
				
			||||||
import { CoreObject } from '@singletons/object';
 | 
					 | 
				
			||||||
import { CoreConstants } from '../constants';
 | 
					import { CoreConstants } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Injectable({ providedIn: 'root' })
 | 
					@Injectable({ providedIn: 'root' })
 | 
				
			||||||
@ -62,10 +61,10 @@ export class CoreRedirectGuard implements CanLoad, CanActivate {
 | 
				
			|||||||
                );
 | 
					                );
 | 
				
			||||||
                const route = Router.parseUrl('/main');
 | 
					                const route = Router.parseUrl('/main');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                route.queryParams = CoreObject.withoutEmpty({
 | 
					                route.queryParams = {
 | 
				
			||||||
                    redirectPath: redirect.page,
 | 
					                    redirectPath: redirect.page,
 | 
				
			||||||
                    redirectParams: redirect.params,
 | 
					                    redirectParams: redirect.params,
 | 
				
			||||||
                });
 | 
					                };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return loggedIn ? route : true;
 | 
					                return loggedIn ? route : true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -78,10 +77,10 @@ export class CoreRedirectGuard implements CanLoad, CanActivate {
 | 
				
			|||||||
            // Redirect to non-site path.
 | 
					            // Redirect to non-site path.
 | 
				
			||||||
            const route = Router.parseUrl(redirect.page);
 | 
					            const route = Router.parseUrl(redirect.page);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            route.queryParams = CoreObject.withoutEmpty({
 | 
					            route.queryParams = {
 | 
				
			||||||
                redirectPath: redirect.page,
 | 
					                redirectPath: redirect.page,
 | 
				
			||||||
                redirectParams: redirect.params,
 | 
					                redirectParams: redirect.params,
 | 
				
			||||||
            });
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return route;
 | 
					            return route;
 | 
				
			||||||
        } finally {
 | 
					        } finally {
 | 
				
			||||||
 | 
				
			|||||||
@ -127,7 +127,7 @@ export class CoreNavigatorService {
 | 
				
			|||||||
        const url: string[] = [/^[./]/.test(path) ? path : `./${path}`];
 | 
					        const url: string[] = [/^[./]/.test(path) ? path : `./${path}`];
 | 
				
			||||||
        const navigationOptions: NavigationOptions = CoreObject.withoutEmpty({
 | 
					        const navigationOptions: NavigationOptions = CoreObject.withoutEmpty({
 | 
				
			||||||
            animated: options.animated,
 | 
					            animated: options.animated,
 | 
				
			||||||
            queryParams: CoreObject.isEmpty(options.params ?? {}) ? null : options.params,
 | 
					            queryParams: CoreObject.isEmpty(options.params ?? {}) ? null : CoreObject.withoutEmpty(options.params),
 | 
				
			||||||
            relativeTo: path.startsWith('/') ? null : this.getCurrentRoute(),
 | 
					            relativeTo: path.startsWith('/') ? null : this.getCurrentRoute(),
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user