Browse Source
			
			
			Merge branch 'main' into remove_upcase
			
			
				pull/4386/head
			
			
		 
		
			
				
					
						
						Daniel García
					
					1 year ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: FC8A7D14C3CD543A
						
					
				
			
		
		
		
	
		
			
				 6 changed files with 
11 additions and 
5 deletions
			 
			
		 
		
			
				- 
					
					
					 
					Cargo.toml
				
 
			
				- 
					
					
					 
					build.rs
				
 
			
				- 
					
					
					 
					src/db/models/attachment.rs
				
 
			
				- 
					
					
					 
					src/db/models/collection.rs
				
 
			
				- 
					
					
					 
					src/db/models/org_policy.rs
				
 
			
				- 
					
					
					 
					src/db/models/two_factor.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -211,7 +211,6 @@ non_ascii_idents = "forbid" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					# Deny | 
					 | 
					 | 
					# Deny | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					future_incompatible = { level = "deny", priority = -1 } | 
					 | 
					 | 
					future_incompatible = { level = "deny", priority = -1 } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					noop_method_call = "deny" | 
					 | 
					 | 
					noop_method_call = "deny" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					pointer_structural_match = "deny" | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					rust_2018_idioms = { level = "deny", priority = -1 } | 
					 | 
					 | 
					rust_2018_idioms = { level = "deny", priority = -1 } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					rust_2021_compatibility = { level = "deny", priority = -1 } | 
					 | 
					 | 
					rust_2021_compatibility = { level = "deny", priority = -1 } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					trivial_casts = "deny" | 
					 | 
					 | 
					trivial_casts = "deny" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -17,6 +17,13 @@ fn main() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        "You need to enable one DB backend. To build with previous defaults do: cargo build --features sqlite" | 
					 | 
					 | 
					        "You need to enable one DB backend. To build with previous defaults do: cargo build --features sqlite" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    ); | 
					 | 
					 | 
					    ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    // Use check-cfg to let cargo know which cfg's we define,
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    // and avoid warnings when they are used in the code.
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    println!("cargo::rustc-check-cfg=cfg(sqlite)"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    println!("cargo::rustc-check-cfg=cfg(mysql)"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    println!("cargo::rustc-check-cfg=cfg(postgresql)"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    println!("cargo::rustc-check-cfg=cfg(query_logger)"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    // Rerun when these paths are changed.
 | 
					 | 
					 | 
					    // Rerun when these paths are changed.
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    // Someone could have checked-out a tag or specific commit, but no other files changed.
 | 
					 | 
					 | 
					    // Someone could have checked-out a tag or specific commit, but no other files changed.
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    println!("cargo:rerun-if-changed=.git"); | 
					 | 
					 | 
					    println!("cargo:rerun-if-changed=.git"); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -95,7 +95,7 @@ impl Attachment { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    pub async fn delete(&self, conn: &mut DbConn) -> EmptyResult { | 
					 | 
					 | 
					    pub async fn delete(&self, conn: &mut DbConn) -> EmptyResult { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        db_run! { conn: { | 
					 | 
					 | 
					        db_run! { conn: { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            crate::util::retry( | 
					 | 
					 | 
					            let _: () = crate::util::retry( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                || diesel::delete(attachments::table.filter(attachments::id.eq(&self.id))).execute(conn), | 
					 | 
					 | 
					                || diesel::delete(attachments::table.filter(attachments::id.eq(&self.id))).execute(conn), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                10, | 
					 | 
					 | 
					                10, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            ) | 
					 | 
					 | 
					            ) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -632,7 +632,7 @@ impl CollectionUser { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        db_run! { conn: { | 
					 | 
					 | 
					        db_run! { conn: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            for user in collectionusers { | 
					 | 
					 | 
					            for user in collectionusers { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                diesel::delete(users_collections::table.filter( | 
					 | 
					 | 
					                let _: () = diesel::delete(users_collections::table.filter( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    users_collections::user_uuid.eq(user_uuid) | 
					 | 
					 | 
					                    users_collections::user_uuid.eq(user_uuid) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    .and(users_collections::collection_uuid.eq(user.collection_uuid)) | 
					 | 
					 | 
					                    .and(users_collections::collection_uuid.eq(user.collection_uuid)) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                )) | 
					 | 
					 | 
					                )) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -115,7 +115,7 @@ impl OrgPolicy { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // We need to make sure we're not going to violate the unique constraint on org_uuid and atype.
 | 
					 | 
					 | 
					                // We need to make sure we're not going to violate the unique constraint on org_uuid and atype.
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does
 | 
					 | 
					 | 
					                // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // not support multiple constraints on ON CONFLICT clauses.
 | 
					 | 
					 | 
					                // not support multiple constraints on ON CONFLICT clauses.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                diesel::delete( | 
					 | 
					 | 
					                let _: () = diesel::delete( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    org_policies::table | 
					 | 
					 | 
					                    org_policies::table | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        .filter(org_policies::org_uuid.eq(&self.org_uuid)) | 
					 | 
					 | 
					                        .filter(org_policies::org_uuid.eq(&self.org_uuid)) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        .filter(org_policies::atype.eq(&self.atype)), | 
					 | 
					 | 
					                        .filter(org_policies::atype.eq(&self.atype)), | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -95,7 +95,7 @@ impl TwoFactor { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // We need to make sure we're not going to violate the unique constraint on user_uuid and atype.
 | 
					 | 
					 | 
					                // We need to make sure we're not going to violate the unique constraint on user_uuid and atype.
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does
 | 
					 | 
					 | 
					                // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // not support multiple constraints on ON CONFLICT clauses.
 | 
					 | 
					 | 
					                // not support multiple constraints on ON CONFLICT clauses.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                diesel::delete(twofactor::table.filter(twofactor::user_uuid.eq(&self.user_uuid)).filter(twofactor::atype.eq(&self.atype))) | 
					 | 
					 | 
					                let _: () = diesel::delete(twofactor::table.filter(twofactor::user_uuid.eq(&self.user_uuid)).filter(twofactor::atype.eq(&self.atype))) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    .execute(conn) | 
					 | 
					 | 
					                    .execute(conn) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    .map_res("Error deleting twofactor for insert")?; | 
					 | 
					 | 
					                    .map_res("Error deleting twofactor for insert")?; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |