Skip to content

Commit

Permalink
refactor/renomeia método
Browse files Browse the repository at this point in the history
-redirect_path -> redirect_after_click
  • Loading branch information
hreis1 committed Feb 15, 2024
1 parent 1f9ef73 commit 90b1c36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def index
def update
notification = Notification.find(params[:id])
notification.clicked!
redirect_to NotificationDecorator.new(notification).redirect_path
redirect_to NotificationDecorator.new(notification).redirect_after_click
end
end
8 changes: 4 additions & 4 deletions app/models/notification_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class NotificationDecorator < SimpleDelegator
def redirect_path
def redirect_after_click
case notifiable
when Comment
notifiable.post
when Connection
notifiable.follower
when Post, Invitation
notifiable
else
when Like
notifiable.likeable.is_a?(Comment) ? notifiable.likeable.post : notifiable.likeable
else
notifiable
end
end
end

0 comments on commit 90b1c36

Please sign in to comment.