Skip to content

Commit 9839e43

Browse files
iHiDclaude
andauthored
Remove admin guard from perk click logging (#9020)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 60ac117 commit 9839e43

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

app/commands/partner/log_perk_click.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,10 @@ class LogPerkClick
55
initialize_with :perk, :user, :clicked_at
66

77
def call
8-
return unless valid_click?
9-
108
Perk.where(id: perk.id).update_all('num_clicks = num_clicks + 1')
119
end
1210

1311
private
14-
def valid_click?
15-
return false if user&.admin?
16-
17-
true
18-
end
19-
2012
def doc
2113
{
2214
perk_id: perk.id,

test/commands/partner/log_perk_click_test.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,4 @@ class Partner::LogPerkClickTest < ActiveSupport::TestCase
99

1010
assert_equal 1, perk.reload.num_clicks
1111
end
12-
13-
test "doesn't log for admin users" do
14-
perk = create :perk
15-
user = create :user, :admin
16-
assert_equal 0, perk.num_clicks
17-
18-
Partner::LogPerkClick.(perk, user, nil)
19-
20-
assert_equal 0, perk.reload.num_clicks
21-
end
2212
end

0 commit comments

Comments
 (0)