Skip to content

Commit cb01966

Browse files
committed
Remove unused Card.published_or_drafted_by scope
As the tests for it could lead to confusion where it seems drafted cards are not accessible to someone with access to the board and with the direct drafted card URL.
1 parent 32a0ace commit cb01966

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

app/models/card/statuses.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ module Card::Statuses
66

77
before_save :mark_if_just_published
88
after_create -> { track_event :published }, if: :published?
9-
10-
scope :published_or_drafted_by, ->(user) { where(status: :published).or(where(status: :drafted, creator: user)) }
119
end
1210

1311
attr_accessor :was_just_published

test/models/card/statuses_test.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@ class Card::StatusesTest < ActiveSupport::TestCase
1111
assert card.drafted?
1212
end
1313

14-
test "cards are only visible to the creator when drafted" do
15-
card = boards(:writebook).cards.create! creator: users(:kevin), title: "Drafted Card"
16-
card.drafted!
17-
18-
assert_includes Card.published_or_drafted_by(users(:kevin)), card
19-
assert_not_includes Card.published_or_drafted_by(users(:jz)), card
20-
end
21-
22-
test "cards are visible to everyone when published" do
23-
card = boards(:writebook).cards.create! creator: users(:kevin), title: "Published Card"
24-
card.published!
25-
26-
assert_includes Card.published_or_drafted_by(users(:kevin)), card
27-
assert_includes Card.published_or_drafted_by(users(:jz)), card
28-
end
29-
3014
test "an event is created when a card is created in the published state" do
3115
assert_no_difference(-> { Event.count }) do
3216
boards(:writebook).cards.create! creator: users(:kevin), title: "Draft Card"

0 commit comments

Comments
 (0)