Browse Source
			
			
			Merge pull request #703 from patrickli/bugfix/dont-sync-excluded-global-domains
			
				Don't include excluded global equivalent domains during sync
			
			
				pull/710/head
			
			
		 
		
			
				
					
						
						Daniel García
					
					6 years ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 4AEE18F83AFDEB23
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
9 additions and 
1 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/api/core/ciphers.rs
				
 
			
				- 
					
					
					 
					src/api/core/mod.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -88,7 +88,7 @@ fn sync(data: Form<SyncData>, headers: Headers, conn: DbConn) -> JsonResult { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    let domains_json = if data.exclude_domains { | 
					 | 
					 | 
					    let domains_json = if data.exclude_domains { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Value::Null | 
					 | 
					 | 
					        Value::Null | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        api::core::get_eq_domains(headers).unwrap().into_inner() | 
					 | 
					 | 
					        api::core::_get_eq_domains(headers, true).unwrap().into_inner() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    }; | 
					 | 
					 | 
					    }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    Ok(Json(json!({ | 
					 | 
					 | 
					    Ok(Json(json!({ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -81,6 +81,10 @@ const GLOBAL_DOMAINS: &str = include_str!("../../static/global_domains.json"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					#[get("/settings/domains")] | 
					 | 
					 | 
					#[get("/settings/domains")] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					fn get_eq_domains(headers: Headers) -> JsonResult { | 
					 | 
					 | 
					fn get_eq_domains(headers: Headers) -> JsonResult { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    _get_eq_domains(headers, false) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					fn _get_eq_domains(headers: Headers, no_excluded: bool) -> JsonResult { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    let user = headers.user; | 
					 | 
					 | 
					    let user = headers.user; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    use serde_json::from_str; | 
					 | 
					 | 
					    use serde_json::from_str; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -93,6 +97,10 @@ fn get_eq_domains(headers: Headers) -> JsonResult { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        global.Excluded = excluded_globals.contains(&global.Type); | 
					 | 
					 | 
					        global.Excluded = excluded_globals.contains(&global.Type); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    if no_excluded { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        globals.retain(|g| !g.Excluded); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    Ok(Json(json!({ | 
					 | 
					 | 
					    Ok(Json(json!({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "EquivalentDomains": equivalent_domains, | 
					 | 
					 | 
					        "EquivalentDomains": equivalent_domains, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "GlobalEquivalentDomains": globals, | 
					 | 
					 | 
					        "GlobalEquivalentDomains": globals, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |