mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-30 16:04:36 -04:00
bookmarks should only show up in a users stream
This commit is contained in:
parent
0244834a97
commit
6c73b3a971
2 changed files with 8 additions and 2 deletions
|
@ -94,6 +94,10 @@ JOIN users pu on pu.id = COALESCE(p.user_id, t.user_id)
|
||||||
unless guardian.can_see_deleted_posts?
|
unless guardian.can_see_deleted_posts?
|
||||||
builder.where("p.deleted_at is null and p2.deleted_at is null")
|
builder.where("p.deleted_at is null and p2.deleted_at is null")
|
||||||
end
|
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
|
if !guardian.can_see_private_messages?(user_id) || ignore_private_messages
|
||||||
builder.where("a.action_type not in (#{NEW_PRIVATE_MESSAGE},#{GOT_PRIVATE_MESSAGE})")
|
builder.where("a.action_type not in (#{NEW_PRIVATE_MESSAGE},#{GOT_PRIVATE_MESSAGE})")
|
||||||
|
|
|
@ -28,6 +28,8 @@ describe UserAction do
|
||||||
row[:action_type] = UserAction::NEW_TOPIC
|
row[:action_type] = UserAction::NEW_TOPIC
|
||||||
UserAction.log_action!(row)
|
UserAction.log_action!(row)
|
||||||
|
|
||||||
|
row[:action_type] = UserAction::BOOKMARK
|
||||||
|
UserAction.log_action!(row)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'stats' do
|
describe 'stats' do
|
||||||
|
@ -63,8 +65,8 @@ describe UserAction do
|
||||||
UserAction.stream(user_id: @user.id, guardian: Guardian.new).count.should == 1
|
UserAction.stream(user_id: @user.id, guardian: Guardian.new).count.should == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have 3 items for non owners' do
|
it 'should have bookmarks and pms for owners' do
|
||||||
UserAction.stream(user_id: @user.id, guardian: @user.guardian).count.should == 3
|
UserAction.stream(user_id: @user.id, guardian: @user.guardian).count.should == 4
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue