MOBILE-2791 login: Fix get site policy when recently added
This commit is contained in:
		
							parent
							
								
									f5115c56e1
								
							
						
					
					
						commit
						35163f473c
					
				@ -335,17 +335,17 @@ export class CoreLoginHelperProvider {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    getSitePolicy(siteId?: string): Promise<string> {
 | 
					    getSitePolicy(siteId?: string): Promise<string> {
 | 
				
			||||||
        return this.sitesProvider.getSite(siteId).then((site) => {
 | 
					        return this.sitesProvider.getSite(siteId).then((site) => {
 | 
				
			||||||
            // Check if it's stored in the site config.
 | 
					            // Try to get the latest config, maybe the site policy was just added or has changed.
 | 
				
			||||||
            const sitePolicy = site.getStoredConfig('sitepolicy');
 | 
					            return site.getConfig('sitepolicy', true).then((sitePolicy) => {
 | 
				
			||||||
            if (typeof sitePolicy != 'undefined') {
 | 
					 | 
				
			||||||
                return sitePolicy ? sitePolicy : Promise.reject(null);
 | 
					                return sitePolicy ? sitePolicy : Promise.reject(null);
 | 
				
			||||||
            }
 | 
					            }, () => {
 | 
				
			||||||
 | 
					                // Cannot get config, try to get the site policy using auth_email_get_signup_settings.
 | 
				
			||||||
            // Not in the config, try to get it using auth_email_get_signup_settings.
 | 
					                return this.wsProvider.callAjax('auth_email_get_signup_settings', {}, { siteUrl: site.getURL() })
 | 
				
			||||||
            return this.wsProvider.callAjax('auth_email_get_signup_settings', {}, { siteUrl: site.getURL() }).then((settings) => {
 | 
					                        .then((settings) => {
 | 
				
			||||||
                    return settings.sitepolicy ? settings.sitepolicy : Promise.reject(null);
 | 
					                    return settings.sitepolicy ? settings.sitepolicy : Promise.reject(null);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user