From 3b1d113a9aabd94cd6e7c99909f819ae9d9c14d6 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Tue, 21 Jun 2016 19:59:05 +0200 Subject: [PATCH] add own posts to activity-stream again --- features/mobile/activity_stream.feature | 17 ++++++++++++++--- lib/evil_query.rb | 6 +++++- spec/lib/evil_query_spec.rb | 2 -- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/features/mobile/activity_stream.feature b/features/mobile/activity_stream.feature index 186f2c290..72a444c79 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 9f96480bd..728bc6595 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 0dc434bc8..731c94979 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