4f19c42958
Use polymorphism instead of case statements in Native push target: - DefaultPayload#category returns "default", #high_priority? returns false - EventPayload#category returns "assignment"/"comment"/"card" based on action - MentionPayload#category returns "mention", #high_priority? returns true This simplifies the Native push target by delegating source-specific logic to the appropriate payload classes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
421 B
Ruby
29 lines
421 B
Ruby
class Notification::MentionPayload < Notification::DefaultPayload
|
|
include ExcerptHelper
|
|
|
|
def title
|
|
"#{mention.mentioner.first_name} mentioned you"
|
|
end
|
|
|
|
def body
|
|
format_excerpt(mention.source.mentionable_content, length: 200)
|
|
end
|
|
|
|
def url
|
|
card_url(card)
|
|
end
|
|
|
|
def category
|
|
"mention"
|
|
end
|
|
|
|
def high_priority?
|
|
true
|
|
end
|
|
|
|
private
|
|
def mention
|
|
notification.source
|
|
end
|
|
end
|