Skip to content
Extraits de code Groupes Projets
Valider 5fb32886 rédigé par Asphyxia's avatar Asphyxia Validation de Marcelo Briones
Parcourir les fichiers

Activity stream keeping retracted participations

parent 5481ddb5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -22,6 +22,7 @@ class Comment < ActiveRecord::Base
belongs_to :commentable, :touch => true, :polymorphic => true
alias_attribute :post, :commentable
belongs_to :author, :class_name => 'Person'
has_one :participation, :dependent => :destroy, :foreign_key => :target_id, :primary_key => :commentable_id
delegate :name, to: :author, prefix: true
delegate :comment_email_subject, to: :parent
......
......@@ -12,6 +12,7 @@ class Like < Federated::Relayable
{:target => @target, :positive => true}
end
end
has_one :participation, :dependent => :destroy, :foreign_key => :target_id, :primary_key => :target_id
after_commit :on => :create do
self.parent.update_likes_counter
......
@javascript
Feature: The activity stream
Background:
Given following users exist:
| username | email |
| Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice |
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
When "alice@alice.alice" has posted a status message with a photo
Scenario: Sorting
When I sign in as "bob@bob.bob"
And I post "A- I like turtles"
And I wait for 1 second
And I post "B- barack obama is your new bicycle"
And I wait for 1 second
And I post "C- barack obama is a square"
And I wait for 1 second
When I go to the activity stream page
Then "C- barack obama is a square" should be post 1
And "B- barack obama is your new bicycle" should be post 2
And "A- I like turtles" should be post 3
When I like the post "A- I like turtles"
And I wait for 1 second
And I comment "Sassy sawfish" on "C- barack obama is a square"
And I wait for 1 second
And I like the post "B- barack obama is your new bicycle"
And I wait for 1 second
When I go to the activity stream page
Then "B- barack obama is your new bicycle" should be post 1
And "C- barack obama is a square" should be post 2
And "A- I like turtles" should be post 3
Scenario: delete a comment
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I focus the comment field
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I wait for the ajax to finish
When I go to the activity stream page
Then I should see "Look at this dog"
And I should see "is that a poodle?"
When I am on "alice@alice.alice"'s page
And I hover over the ".comment"
And I preemptively confirm the alert
And I click to delete the first comment
And I wait for the ajax to finish
And I go to the activity stream page
Then I should not see "Look at this dog"
Scenario: unliking a post
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I like the post "Look at this dog"
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
And I unlike the post "Look at this dog"
And I go to the activity stream page
Then I should not see "Look at this dog"
Scenario: multiple participations
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I like the post "Look at this dog"
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I focus the comment field
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I wait for the ajax to finish
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
And I unlike the post "Look at this dog"
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
And I hover over the ".comment"
And I preemptively confirm the alert
And I click to delete the first comment
And I wait for the ajax to finish
And I go to the activity stream page
Then I should not see "Look at this dog"
......@@ -2,6 +2,14 @@ When /^I (?:like|unlike) the post "([^"]*)" in the stream$/ do |post_text|
like_stream_post(post_text)
end
Then /^I should see an image in the publisher$/ do
photo_in_publisher.should be_present
end
Then /^I (un)?like the post "([^"]*)"$/ do |negate, post_text|
negate ? unlike_post(post_text) : like_post(post_text)
end
Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position|
stream_element_numbers_content(position).should have_content(post_text)
end
......
......@@ -106,6 +106,12 @@ module PublishingCukeHelpers
end
end
def unlike_post(post_text)
within_post(post_text) do
find(:css, 'a.unlike').click
end
end
def stream_posts
all('.stream_element')
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter