Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fixed show post page for non authenticated users.

Matt Robertsa59610d8684c
diff --git a/e2e/features/ui/post.feature b/e2e/features/ui/post.feature
index 47c01fec9..ba0d12d8b 100644
--- a/e2e/features/ui/post.feature
+++ b/e2e/features/ui/post.feature
@@ -8,4 +8,12 @@ Feature: Post
And I click submit new post
Then I should be on the show post page
And I should see "Feature Request Example" as the post title
+ And I should see 1 vote(s)
+
+ Scenario: Non-logged in user can view a post
+ Given I go to the home page
+ And I search for "Feature Request Example"
+ And I click on the first post
+ Then I should be on the show post page
+ And I should see "Feature Request Example" as the post title
And I should see 1 vote(s)
\ No newline at end of file
diff --git a/e2e/step_definitions/home.steps.ts b/e2e/step_definitions/home.steps.ts
index a8e5d397e..9c50e6ad4 100644
--- a/e2e/step_definitions/home.steps.ts
+++ b/e2e/step_definitions/home.steps.ts
@@ -11,6 +11,14 @@ Then("I should be on the home page", async function (this: FiderWorld) {
expect(container).toBeDefined()
})
+Then("I click on the first post", async function (this: FiderWorld) {
+ await this.page.click(".c-posts-container__post:first-child a")
+})
+
+Then("I search for {string}", async function (this: FiderWorld, searchTerm: string) {
+ await this.page.type("#input-query", searchTerm)
+})
+
Given("I type {string} as the title", async function (this: FiderWorld, title: string) {
await this.page.type("#input-title", title)
})
diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsx
index 21895c920..590e03805 100644
--- a/public/pages/Home/components/ListPosts.tsx
+++ b/public/pages/Home/components/ListPosts.tsx
@@ -12,7 +12,7 @@ interface ListPostsProps {
const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) => {
return (
- <HStack spacing={4} align="start">
+ <HStack spacing={4} align="start" className="c-posts-container__post">
<div>
<VoteCounter post={props.post} />
</div>
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index 481e175d7..9ea23ce88 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -215,7 +215,7 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
<Dropdown.ListItem onClick={this.onActionSelected("copy")}>
<Trans id="action.copylink">Copy link</Trans>
</Dropdown.ListItem>
- {canEditPost(Fider.session.user, this.props.post) && (
+ {Fider.session.isAuthenticated && canEditPost(Fider.session.user, this.props.post) && (
<>
<Dropdown.ListItem onClick={this.onActionSelected("edit")}>
<Trans id="action.edit">Edit</Trans>
@@ -238,7 +238,7 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
<ResponseDetails status={this.props.post.status} response={this.props.post.response} />
<DeletePostModal onModalClose={() => this.setShowDeleteModal(false)} showModal={this.state.showDeleteModal} post={this.props.post} />
- {Fider.session.user.isCollaborator && (
+ {Fider.session.isAuthenticated && Fider.session.user.isCollaborator && (
<ResponseModal onCloseModal={() => this.setShowResponseModal(false)} showModal={this.state.showResponseModal} post={this.props.post} />
)}
{!this.state.editMode && (