Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/views/comments/_comment_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@
<dl>
<dt class="landmark"><%= t(".landmark.note") %>:</dt>
<dd class="instructions comment_form"><%= t(".guest_instructions") %></dd>
<dt><%= f.label "name_for_#{commentable.id}", t(".guest_name") %></dt>
<dd>
<dt class="required"><%= f.label "name_for_#{commentable.id}", t(".guest_name") %></dt>
<dd class="required">
<%= f.text_field :name, id: "comment_name_for_#{commentable.id}" %>
<%= live_validation_for_field("comment_name_for_#{commentable.id}", failureMessage: t(".guest_name_failure")) %>
</dd>
<dt><%= f.label "email_for_#{commentable.id}", t(".guest_email") %></dt>
<dd>
<dt class="required"><%= f.label "email_for_#{commentable.id}", t(".guest_email") %></dt>
<dd class="required">
<%= f.text_field :email, id: "comment_email_for_#{commentable.id}" %>
<%= live_validation_for_field("comment_email_for_#{commentable.id}", failureMessage: t(".guest_email_failure")) %>
</dd>
Expand All @@ -101,6 +101,9 @@
failureMessage: t(".comment_too_short"),
maximum_length: ArchiveConfig.COMMENT_MAX,
tooLongMessage: t(".comment_too_long", count: ArchiveConfig.COMMENT_MAX) %>
<% unless logged_in? %>
<p class="footnote"><%= t(".guest_edit_warning") %></p>
<% end %>
<p class="submit actions">
<%= f.submit button_name, id: "comment_submit_for_#{commentable.id}", data: { disable_with: t(".processing_message") } %>
<% if controller.controller_name == 'inbox' %>
Expand Down
7 changes: 4 additions & 3 deletions config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,11 @@ en:
comment_field_title: Enter Comment
comment_too_long: must be less than %{count} characters long.
comment_too_short: Brevity is the soul of wit, but we need your comment to have text in it.
guest_email: Guest email
guest_edit_warning: You will not be able to edit or delete your comment after it is posted.
guest_email: Guest email (required)
guest_email_failure: Please enter your email address.
guest_instructions: All fields are required. Your email address will not be published.
guest_name: Guest name
guest_instructions: All fields are required. Your name and comment text will both be publicly displayed. Your email address will not be made public, but it will be used to send you notifications of any replies to your comment.
guest_name: Guest name (required)
guest_name_failure: Please enter your name.
inbox_reference_html: to %{commentable_creator} on %{commentable_link}
landmark:
Expand Down
17 changes: 17 additions & 0 deletions features/comments_and_kudos/guest_comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,20 @@ Scenario: Guest comments with embedded images are rendered as plain text
And I should see "alt="
And I should see "baz"
But I should not see the image "src" text "https://example.com/image.jpg"

Scenario: Guest sees warning footnote and required fields on comment form
Given the work "Test Work" by "author" with guest comments enabled
When I go to the work "Test Work"
Then I should see "You will not be able to edit or delete your comment after it is posted."
And I should see "Guest name (required)"
And I should see "Guest email (required)"
And I should see "All fields are required. Your name and comment text will both be publicly displayed. Your email address will not be made public, but it will be used to send you notifications of any replies to your comment."

Scenario: Logged-in user does not see guest-specific elements
Given the work "Test Work" by "author" with guest comments enabled
And I am logged in as "commenter"
When I go to the work "Test Work"
Then I should not see "You will not be able to edit or delete your comment after it is posted."
And I should not see "Guest name (required)"
And I should not see "Guest email (required)"
And I should not see "All fields are required. Your name and comment text will both be publicly displayed. Your email address will not be made public, but it will be used to send you notifications of any replies to your comment."
Loading