remove .get

This commit is contained in:
KOUNOIKE Yuusuke
2017-04-02 15:42:21 +09:00
parent 3bb32f11d7
commit 83a27809ef

View File

@@ -151,16 +151,16 @@ trait AccountControllerBase extends AccountManagementControllerBase {
get("/:userName/_avatar"){ get("/:userName/_avatar"){
val userName = params("userName") val userName = params("userName")
contentType = "image/png" contentType = "image/png"
getAccountByUserName(userName).map{ account => getAccountByUserName(userName).flatMap{ account =>
response.setDateHeader("Last-Modified", account.updatedDate.getTime) response.setDateHeader("Last-Modified", account.updatedDate.getTime)
account.image.map{ image => account.image.map{ image =>
RawData(FileUtil.getMimeType(image), new java.io.File(getUserUploadDir(userName), image)) Some(RawData(FileUtil.getMimeType(image), new java.io.File(getUserUploadDir(userName), image)))
}.getOrElse{ }.getOrElse{
(if (account.isGroupAccount) { if (account.isGroupAccount) {
TextAvatarUtil.textGroupAvatar(account.fullName) TextAvatarUtil.textGroupAvatar(account.fullName)
} else { } else {
TextAvatarUtil.textAvatar(account.fullName) TextAvatarUtil.textAvatar(account.fullName)
}).get }
} }
}.getOrElse{ }.getOrElse{
response.setHeader("Cache-Control", "max-age=3600") response.setHeader("Cache-Control", "max-age=3600")