diff --git a/features/mobile/activity_stream.feature b/features/mobile/activity_stream.feature index 186f2c290fe2b136e0de8814f6d02e3515199af5..72a444c7942e653ccf89629f9063b3c77cb5a389 100644 --- a/features/mobile/activity_stream.feature +++ b/features/mobile/activity_stream.feature @@ -5,17 +5,28 @@ Feature: Viewing my activity on the steam mobile page I want to view my activity stream Background: - Given a user with username "alice" + Given following users exist: + | username | + | alice | + | bob | + And a user with username "bob" is connected with "alice" And "alice@alice.alice" has a public post with text "Hello! I am #newhere" - And I sign in as "alice@alice.alice" on the mobile website Scenario: Show my activity empty + When I sign in as "bob@bob.bob" on the mobile website When I go to the activity stream page Then I should see "My activity" within "#main" And I should not see "Hello! I am #newhere" - Scenario: Show post on my activity + Scenario: Show liked post on my activity + When I sign in as "bob@bob.bob" on the mobile website When I click on selector "a.like-action.inactive" And I go to the activity stream page Then I should see "My activity" within "#main" And I should see "Hello! I am #newhere" within ".ltr" + + Scenario: Show own post on my activity + When I sign in as "alice@alice.alice" on the mobile website + And I go to the activity stream page + Then I should see "My activity" within "#main" + And I should see "Hello! I am #newhere" within ".ltr" diff --git a/lib/evil_query.rb b/lib/evil_query.rb index 9f96480bd1391217736f398f72060e1d601b2a5a..728bc65956307159708e4ca5e960800fc011d34b 100644 --- a/lib/evil_query.rb +++ b/lib/evil_query.rb @@ -19,7 +19,11 @@ module EvilQuery end def posts - Post.joins(:participations).where(:participations => {:author_id => @user.person.id}).order("posts.interacted_at DESC") + author_id = @user.person_id + Post.joins("LEFT OUTER JOIN participations ON participations.target_id = posts.id AND " \ + "participations.target_type = 'Post'") + .where(::Participation.arel_table[:author_id].eq(author_id).or(Post.arel_table[:author_id].eq(author_id))) + .order("posts.interacted_at DESC") end end diff --git a/spec/lib/evil_query_spec.rb b/spec/lib/evil_query_spec.rb index 0dc434bc8fe10640ded948d22f95c6fb0cde78cc..731c94979a397cfdd0110d0bf765a35280e8b53f 100644 --- a/spec/lib/evil_query_spec.rb +++ b/spec/lib/evil_query_spec.rb @@ -36,8 +36,6 @@ end describe EvilQuery::Participation do before do @status_message = FactoryGirl.create(:status_message, :author => bob.person) - # done in StatusMessagesController#create - bob.participate!(@status_message) end it "includes posts liked by the user" do