From 90b1c36b6fdb4b6afab349c5f884ab402165f764 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Date: Thu, 15 Feb 2024 13:11:32 -0300 Subject: [PATCH] =?UTF-8?q?refactor/renomeia=20m=C3=A9todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -redirect_path -> redirect_after_click --- app/controllers/notifications_controller.rb | 2 +- app/models/notification_decorator.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index c44b721..fe59ab9 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -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 diff --git a/app/models/notification_decorator.rb b/app/models/notification_decorator.rb index ad86f0a..da41f11 100644 --- a/app/models/notification_decorator.rb +++ b/app/models/notification_decorator.rb @@ -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