Skip to content

Commit

Permalink
fix: (#346) 빈 이미지 처리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
woo-chang committed Aug 12, 2023
1 parent cb608ae commit 78c2432
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static PostOptionResponse of(final Post post, final PostOption postOption
}

private static String convertImageUrl(final String imageUrl) {
return imageUrl == null || imageUrl.contains("없는사진") ? "" : imageUrl;
return imageUrl == null ? "" : imageUrl;
}

public static PostOptionResponse of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static PostResponse of(final Post post, final Member loginMember) {
}

private static String convertImageUrl(final String imageUrl) {
return imageUrl == null || imageUrl.contains("없는사진") ? "" : imageUrl;
return imageUrl == null ? "" : imageUrl;
}

private static List<CategoryResponse> getCategories(final Post post) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static PostDetailResponse of(final Post post, final Member loginMember) {
WriterResponse.of(writer.getId(), writer.getNickname()),
postBody.getTitle(),
postBody.getContent(),
convertImageUrl(contentImageUrl.toString()),
contentImageUrl.toString(),
getCategories(postCategories.getPostCategories()),
post.getCreatedAt(),
post.getDeadline(),
Expand All @@ -54,10 +54,6 @@ public static PostDetailResponse of(final Post post, final Member loginMember) {
);
}

private static String convertImageUrl(final String imageUrl) {
return imageUrl.contains("없는사진") ? "" : imageUrl;
}

private static List<CategoryResponse> getCategories(final List<PostCategory> postCategories) {
return postCategories.stream()
.map(PostCategory::getCategory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ public static PostOptionDetailResponse of(
return new PostOptionDetailResponse(
postOption.getId(),
postOption.getContent(),
convertImageUrl(postOption.getImageUrl()),
postOption.getImageUrl(),
postOption.getVoteCount(isVisibleVoteResult),
postOption.getVotePercent(totalVoteCount)
);
}

private static String convertImageUrl(final String imageUrl) {
return imageUrl.contains("없는사진") ? "" : imageUrl;
}

}

0 comments on commit 78c2432

Please sign in to comment.