mirror of
				https://github.com/gitbucket/gitbucket.git
				synced 2025-10-30 18:15:59 +01:00 
			
		
		
		
	modify fields to option
This commit is contained in:
		| @@ -1,11 +1,11 @@ | ||||
| package gitbucket.core.api | ||||
|  | ||||
| case class UpdateAUser( | ||||
|   name: String, | ||||
|   email: String, | ||||
|   blog: String, | ||||
|   company: String, | ||||
|   location: String, | ||||
|   hireable: Boolean, | ||||
|   bio: String | ||||
|   name: Option[String], | ||||
|   email: Option[String], | ||||
|   blog: Option[String], | ||||
|   company: Option[String], | ||||
|   location: Option[String], | ||||
|   hireable: Option[Boolean], | ||||
|   bio: Option[String] | ||||
| ) | ||||
|   | ||||
| @@ -38,9 +38,9 @@ trait ApiUserControllerBase extends ControllerBase { | ||||
|     (for { | ||||
|       data <- extractFromJsonBody[UpdateAUser] | ||||
|     } yield { | ||||
|       val updatedAccount = context.loginAccount.get.copy( | ||||
|         mailAddress = data.email, | ||||
|         description = Some(data.bio) | ||||
|       val loginAccount = context.loginAccount.get | ||||
|       val updatedAccount = loginAccount.copy( | ||||
|         mailAddress = data.email.getOrElse(loginAccount.mailAddress) | ||||
|       ) | ||||
|       updateAccount(updatedAccount) | ||||
|       JsonFormat(ApiUser(updatedAccount)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user