Skip to content

Commit

Permalink
Merge pull request #1683 from sarken/issue_4003
Browse files Browse the repository at this point in the history
4003 & 4011 Show timestamps in inbox & tweak preference help text
  • Loading branch information
CristinaRO committed Jun 14, 2014
2 parents 461fe37 + 5e30af9 commit c60c544
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 30 deletions.
25 changes: 14 additions & 11 deletions app/views/inbox/show.html.erb
Expand Up @@ -4,6 +4,9 @@
<%= flash_div :comment_error, :comment_notice %>
<!--/descriptions-->

<!--subnav-->
<!--/subnav-->

<!--main content-->
<% unless @inbox_comments.blank? %>
Expand Down Expand Up @@ -32,18 +35,18 @@

<!-- START of single comment -->
<li class="<%= inbox_comment.read? ? 'read' : 'unread' %> comment group" role="article">
<% if !feedback_comment.pseud.nil? %>
<% if feedback_comment.pseud.user.is_author_of?(feedback_comment.ultimate_parent) && feedback_comment.ultimate_parent.anonymous? %>
<h4 class="heading byline"><%= "Anonymous Creator" %> <%= ts("on") %> <%= commentable_description_link(feedback_comment) %> </h4>
<h4 class="heading byline">
<% if !feedback_comment.pseud.nil? %>
<% if feedback_comment.pseud.user.is_author_of?(feedback_comment.ultimate_parent) && feedback_comment.ultimate_parent.anonymous? %>
<%= ts('Anonymous Creator on') %> <%= commentable_description_link(feedback_comment) %>
<% else %>
<%= get_commenter_pseud_or_name(feedback_comment) %> <%= ts("on") %> <%= commentable_description_link(feedback_comment) %>
<% end %>
<% else %>
<h4 class="heading byline"><%= get_commenter_pseud_or_name(feedback_comment) %> <%= ts("on") %> <%= commentable_description_link(feedback_comment) %> </h4>
<% end %>
<% else %>
<h4 class="heading byline">
<%= get_commenter_pseud_or_name(feedback_comment) %> <%= ts("on") %> <%= commentable_description_link(feedback_comment) %>
<span class="posted datetime"><%= distance_of_time_in_words_to_now(inbox_comment.created_at) %></span>
</h4>
<% end %>
<% end %>
<span class="posted datetime"><%= distance_of_time_in_words_to_now(inbox_comment.created_at) %></span>
</h4>

<div class="icon">
<% if !feedback_comment.pseud.nil? %>
Expand Down Expand Up @@ -108,7 +111,7 @@
<!--/content-->

<!--subnav-->
<%= form_tag(user_inbox_path(@user), :class => 'filters', :method => :get) do %>
<%= form_tag(user_inbox_path(@user), method: :get, class: 'filters', id: 'inbox-filters') do %>
<h3 class="landmark heading"><%= ts("Filter") %></h3>
<%= field_set_tag do %>
<dl class="filters" role="menu">
Expand Down
2 changes: 1 addition & 1 deletion features/comments_and_kudos/add_comment.feature
Expand Up @@ -121,7 +121,7 @@ Scenario: Set preference and receive comment notifications of your own comments
When I am logged in as "author"
And I post the work "Generic Work"
When I am logged in as "commenter"
And I set my preferences to receive copies of my own comments
And I set my preferences to turn on copies of my own comments
And I post the comment "Something" on the work "Generic Work"
Then "author" should be emailed
And "commenter" should be emailed
Expand Down
4 changes: 2 additions & 2 deletions features/comments_and_kudos/comments_adminposts.feature
Expand Up @@ -14,7 +14,7 @@ Feature: Commenting on admin posts
Scenario: A user who receives copies of their own comments comments on an admin post
Given I have posted an admin post
And I am logged in as "narcis"
And I set my preferences to receive copies of my own comments
And I set my preferences to turn on copies of my own comments
And all emails have been delivered
When I comment on an admin post
Then 1 email should be delivered to "narcis"
Expand All @@ -30,7 +30,7 @@ Feature: Commenting on admin posts
Scenario: A user who receives copies of their own comments edits a comment on an admin post
Given I have posted an admin post
And I am logged in as "narcis"
And I set my preferences to receive copies of my own comments
And I set my preferences to turn on copies of my own comments
And I comment on an admin post
And all emails have been delivered
When I edit a comment
Expand Down
45 changes: 45 additions & 0 deletions features/comments_and_kudos/inbox.feature
@@ -0,0 +1,45 @@
Feature: Get messages in the inbox
In order to stay informed about activity concerning my works and comments
As a user
I'd like to get messages in my inbox

Scenario: I should not receive comments in my inbox if I have set my preferences to "Turn off messages to your inbox about comments."
Given I am logged in as "boxer" with password "10987tko"
And I post the work "Another Round"
And I set my preferences to turn off messages to my inbox about comments
When I am logged in as "cutman"
And I post the comment "You should not receive this in your inbox." on the work "Another Round"
When I am logged in as "boxer" with password "10987tko"
And I go to my inbox page
Then I should not see "cutman on Another Round"
And I should not see "You should not receive this in your inbox."

Scenario: I should receive comments in my inbox if I haven't set my preferences to "Turn off messages to your inbox about comments."
Given I am logged in as "boxer" with password "10987tko"
And I post the work "The Fight"
And I set my preferences to turn on messages to my inbox about comments
When I am logged in as "cutman"
And I post the comment "You should receive this in your inbox." on the work "The Fight"
When I am logged in as "boxer" with password "10987tko"
And I go to my inbox page
Then I should see "cutman on The Fight"
And I should see "You should receive this in your inbox."

Scenario: Logged in comments in my inbox should have timestamps
Given I am logged in as "boxer" with password "10987tko"
And I post the work "Down for the Count"
When I am logged in as "cutman"
And I post the comment "It was a right hook... with a bit of a jab. (And he did it with his left hand.)" on the work "Down for the Count"
When I am logged in as "boxer" with password "10987tko"
And I go to my inbox page
Then I should see "cutman on Down for the Count"
And I should see "less than 1 minute ago"

Scenario: Logged in comments in my inbox should have timestamps
Given I am logged in as "boxer" with password "10987tko"
And I post the work "Down for the Count"
When I post the comment "The fight game's complex." on the work "Down for the Count" as a guest
When I am logged in as "boxer" with password "10987tko"
And I go to my inbox page
Then I should see "guest on Down for the Count"
And I should see "less than 1 minute ago"
10 changes: 5 additions & 5 deletions features/step_definitions/comment_steps.rb
Expand Up @@ -4,7 +4,7 @@
end

Given /^I have the receive all comment notifications setup$/ do
step %{I set my preferences to receive copies of my own comments}
step %{I set my preferences to turn on copies of my own comments}
end

Given /^I have the receive no comment notifications setup$/ do
Expand All @@ -31,6 +31,10 @@
step %{I should see "New comment on"}
end

Then /^I should see the reply to comment form$/ do
step %{I should see "Comment as" within ".odd"}
end

# WHEN

When /^I set up the comment "([^"]*)" on the work "([^"]*)"$/ do |comment_text, work|
Expand Down Expand Up @@ -101,7 +105,3 @@
step %{I follow "Delete" within ".odd"}
step %{I follow "Yes, delete!"}
end

Then /^I should see the reply to comment form$/ do
step %{I should see "Comment as" within ".odd"}
end
30 changes: 24 additions & 6 deletions features/step_definitions/preferences_steps.rb
Expand Up @@ -4,12 +4,6 @@
user.preference.save
end

When /^I set my preferences to receive copies of my own comments$/ do
user = User.current_user
user.preference.comment_copy_to_self_off = false
user.preference.save
end

When /^I set my preferences to turn off notification emails for comments$/ do
user = User.current_user
user.preference.comment_emails_off = true
Expand Down Expand Up @@ -45,3 +39,27 @@
user.preference.disable_share_links = true
user.preference.save
end

When /^I set my preferences to turn off messages to my inbox about comments$/ do
user = User.current_user
user.preference.comment_inbox_off = true
user.preference.save
end

When /^I set my preferences to turn on messages to my inbox about comments$/ do
user = User.current_user
user.preference.comment_inbox_off = false
user.preference.save
end

When /^I set my preferences to turn off copies of my own comments$/ do
user = User.current_user
user.preference.comment_copy_to_self_off = true
user.preference.save
end

When /^I set my preferences to turn on copies of my own comments$/ do
user = User.current_user
user.preference.comment_copy_to_self_off = false
user.preference.save
end
2 changes: 2 additions & 0 deletions features/support/paths.rb
Expand Up @@ -101,6 +101,8 @@ def path_to(page_name)
user_signups_path(User.current_user)
when /my related works page/
user_related_works_path(User.current_user)
when /my inbox page/
user_inbox_path(User.current_user)
when /the import page/
new_work_path(:import => 'true')
when /the work-skins page/
Expand Down
9 changes: 4 additions & 5 deletions public/help/comment-preferences.html
@@ -1,15 +1,14 @@
<h4>Comment Preferences</h4>

<dl id="help">

<dt>Turn off emails about comments</dt>
<dd>Enable this option if you would prefer not to receive email alerts when someone comments on your work or replies to a comment you have made. Comment notifications will still be delivered to your Archive inbox unless you have chosen to disable them.</dd>
<dt>Turn off messages to your inbox about comments</dt>
<dt>Turn off messages to your inbox about comments</dt>
<dd>Enable this option if you would prefer not to receive notifications in your Archive inbox when someone comments on your work or replies to a comment you have made. Comment notifications will still be emailed to you unless you have chosen to disable them.</dd>
<dt>Turn off copies of your own comments</dt>
<dd>Enable this option if you prefer not to receive emails or inbox notifications for your own comments (for example, when you reply to comments on your own works).</dd>
<dt>Turn off emails about kudos</dt>
<dd>Enable this option if you prefer not to receive emails for your own comments (for example, when you reply to comments on your own works).</dd>
<dt>Turn off emails about kudos</dt>
<dd>Enable this option if you would prefer not to receive email notifications when someone leaves kudos on your work.</dd>
<dt>Turn off admin emails</dt>
<dt>Turn off admin emails</dt>
<dd>Occasionally, Archive staff may send out email notices to all users, for example to notify people of proposed changes to the Terms of Service or site downtime. If you would prefer not to receive such emails, please enable this option. Note that if you choose to disable this option, you may miss important information about site changes or events.</dd>
</dl>

0 comments on commit c60c544

Please sign in to comment.