Skip to content

Commit d4a15d5

Browse files
committed
Fix corrections
1 parent 0638bf3 commit d4a15d5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

27/blog-frontend/src/components/post/PostViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const PostViewer = ({ post, error, loading, actionButtons, ownPost }) => {
5555
/>
5656
<Tags tags={tags} />
5757
</PostHead>
58-
{ownPost && actionButtons}
58+
{actionButtons}
5959
<PostContent dangerouslySetInnerHTML={{ __html: body }} />
6060
</PostViewerBlock>
6161
);

27/blog-frontend/src/containers/post/PostViewerContainer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ const PostViewerContainer = ({ match, history }) => {
4242
}
4343
};
4444

45+
const ownPost = (user && user.id) === (post && post.user.id);
46+
4547
return (
4648
<PostViewer
4749
post={post}
4850
loading={loading}
4951
error={error}
50-
actionButtons={<PostActionButtons onEdit={onEdit} onRemove={onRemove} />}
51-
ownPost={user && user.id === post && post.id}
52+
actionButtons={
53+
ownPost && <PostActionButtons onEdit={onEdit} onRemove={onRemove} />
54+
}
5255
/>
5356
);
5457
};

corrections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ input {
105105
`ownPost` 값을 설정하는 로직에 오탈자가 있습니다. 추가적으로 PostViewer 에서 `ownPost` 를 사용하는 코드가 빠졌습니다. 따라서, 페이지에 최소한의 수정을 하기 위하여 `ownPost` 라는 상수를 따로 선언하고 `actionButtons` props 를 설정하는 과정에서 조건부 렌더링을 하는 방식으로 수정됐습니다.
106106

107107
```diff
108-
+ const ownPost = user && user.id === post && post.user.id;
108+
+ const ownPost = (user && user.id) === (post && post.user.id);
109109

110110
return (
111111
<PostViewer

0 commit comments

Comments
 (0)