diff --git a/app/controllers/shared/trips_controller.rb b/app/controllers/shared/trips_controller.rb index 570e6073..9b583295 100644 --- a/app/controllers/shared/trips_controller.rb +++ b/app/controllers/shared/trips_controller.rb @@ -4,10 +4,7 @@ class Shared::TripsController < ApplicationController def show @trip = Trip.find_by(sharing_uuid: params[:trip_uuid]) - unless @trip&.public_accessible? - return redirect_to root_path, - alert: 'Shared trip not found or no longer available' - end + redirect_to root_path, alert: 'Shared trip not found or no longer available' and return unless @trip&.public_accessible? @user = @trip.user @is_public_view = true diff --git a/app/controllers/trips_controller.rb b/app/controllers/trips_controller.rb index 3b8ec498..2818b4af 100644 --- a/app/controllers/trips_controller.rb +++ b/app/controllers/trips_controller.rb @@ -40,9 +40,7 @@ class TripsController < ApplicationController def update # Handle sharing settings update (JSON response) - if params[:sharing] - return update_sharing - end + update_sharing and return if params[:sharing] # Handle regular trip update if @trip.update(trip_params)