Change and add Comments to the profile endpoints
Add missing docs Took 9 minutes
This commit is contained in:
		
							parent
							
								
									49fe5e3271
								
							
						
					
					
						commit
						8bcbc983c3
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		
							
								
								
									
										11
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/main.rs
									
									
									
									
									
								
							|  | @ -299,7 +299,7 @@ fn set_displayname_route( | ||||||
| ) -> MatrixResult<set_display_name::Response> { | ) -> MatrixResult<set_display_name::Response> { | ||||||
|     let user_id = body.user_id.clone().expect("user is authenticated"); |     let user_id = body.user_id.clone().expect("user is authenticated"); | ||||||
| 
 | 
 | ||||||
|     // Send error on None and accept Some("") as valid username
 |     // Send error on None
 | ||||||
|     // Synapse returns a parsing error but the spec doesn't require this
 |     // Synapse returns a parsing error but the spec doesn't require this
 | ||||||
|     if body.displayname.is_none() { |     if body.displayname.is_none() { | ||||||
|         debug!("Request was missing the displayname payload."); |         debug!("Request was missing the displayname payload."); | ||||||
|  | @ -311,6 +311,7 @@ fn set_displayname_route( | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if let Some(displayname) = body.displayname { |     if let Some(displayname) = body.displayname { | ||||||
|  |         // Some("") will clear the displayname
 | ||||||
|         if displayname == "" { |         if displayname == "" { | ||||||
|             data.displayname_remove(&user_id); |             data.displayname_remove(&user_id); | ||||||
|         } else { |         } else { | ||||||
|  | @ -338,7 +339,7 @@ fn get_displayname_route( | ||||||
|         debug!("Profile was not found."); |         debug!("Profile was not found."); | ||||||
|         MatrixResult(Err(Error { |         MatrixResult(Err(Error { | ||||||
|             kind: ErrorKind::NotFound, |             kind: ErrorKind::NotFound, | ||||||
|             message: "Profile was not found".to_owned(), |             message: "Profile was not found.".to_owned(), | ||||||
|             status_code: http::StatusCode::NOT_FOUND, |             status_code: http::StatusCode::NOT_FOUND, | ||||||
|         })) |         })) | ||||||
|     } |     } | ||||||
|  | @ -348,6 +349,7 @@ fn get_displayname_route( | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     // The user has no displayname
 | ||||||
|     MatrixResult(Ok(get_display_name::Response { displayname: None })) |     MatrixResult(Ok(get_display_name::Response { displayname: None })) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -394,7 +396,7 @@ fn get_avatar_url_route( | ||||||
|         debug!("Profile was not found."); |         debug!("Profile was not found."); | ||||||
|         MatrixResult(Err(Error { |         MatrixResult(Err(Error { | ||||||
|             kind: ErrorKind::NotFound, |             kind: ErrorKind::NotFound, | ||||||
|             message: "Profile was not found".to_owned(), |             message: "Profile was not found.".to_owned(), | ||||||
|             status_code: http::StatusCode::NOT_FOUND, |             status_code: http::StatusCode::NOT_FOUND, | ||||||
|         })) |         })) | ||||||
|     } |     } | ||||||
|  | @ -404,6 +406,7 @@ fn get_avatar_url_route( | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     // The user has no avatar
 | ||||||
|     MatrixResult(Ok(get_avatar_url::Response { avatar_url: None })) |     MatrixResult(Ok(get_avatar_url::Response { avatar_url: None })) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -428,7 +431,7 @@ fn get_profile_route( | ||||||
|     debug!("Profile was not found."); |     debug!("Profile was not found."); | ||||||
|     MatrixResult(Err(Error { |     MatrixResult(Err(Error { | ||||||
|         kind: ErrorKind::NotFound, |         kind: ErrorKind::NotFound, | ||||||
|         message: "Profile was not found".to_owned(), |         message: "Profile was not found.".to_owned(), | ||||||
|         status_code: http::StatusCode::NOT_FOUND, |         status_code: http::StatusCode::NOT_FOUND, | ||||||
|     })) |     })) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue