Skip to content

Commit 8f953ce

Browse files
author
omerfaruk-pseud
committed
AO3-7238 convert if-elsif to case-when
1 parent 5101069 commit 8f953ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/models/comment.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ def akismet_attributes
107107
# While we do have tag comments, those are from logged-in users with special
108108
# access granted by admins, so we never spam check them, unlike comments on
109109
# works or admin posts.
110-
if ultimate_parent.is_a?(Work)
110+
case ultimate_parent
111+
when ->(p) { p.is_a?(Work) }
111112
comment_type = "fanwork-comment"
112113
comment_post_modified_gmt = ultimate_parent.revised_at.iso8601
113-
elsif ultimate_parent.is_a?(AdminPost)
114+
when ->(p) { p.is_a?(AdminPost) }
114115
comment_type = "comment"
115116
comment_post_modified_gmt = ultimate_parent.created_at.iso8601
116117
end

0 commit comments

Comments
 (0)