bookmarks should only show up in a users stream

This commit is contained in:
Sam Saffron 2013-02-15 10:58:03 +11:00
parent 0244834a97
commit 6c73b3a971
2 changed files with 8 additions and 2 deletions

View File

@ -94,6 +94,10 @@ JOIN users pu on pu.id = COALESCE(p.user_id, t.user_id)
unless guardian.can_see_deleted_posts?
builder.where("p.deleted_at is null and p2.deleted_at is null")
end
unless guardian.user && guardian.user.id == user_id
builder.where("a.action_type not in (#{BOOKMARK})")
end
if !guardian.can_see_private_messages?(user_id) || ignore_private_messages
builder.where("a.action_type not in (#{NEW_PRIVATE_MESSAGE},#{GOT_PRIVATE_MESSAGE})")

View File

@ -28,6 +28,8 @@ describe UserAction do
row[:action_type] = UserAction::NEW_TOPIC
UserAction.log_action!(row)
row[:action_type] = UserAction::BOOKMARK
UserAction.log_action!(row)
end
describe 'stats' do
@ -63,8 +65,8 @@ describe UserAction do
UserAction.stream(user_id: @user.id, guardian: Guardian.new).count.should == 1
end
it 'should have 3 items for non owners' do
UserAction.stream(user_id: @user.id, guardian: @user.guardian).count.should == 3
it 'should have bookmarks and pms for owners' do
UserAction.stream(user_id: @user.id, guardian: @user.guardian).count.should == 4
end
end