From d83d01eb1e2f2ae56cd3f3a40e254fcfec51360c Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 1 Dec 2023 10:52:56 -0500 Subject: [PATCH] Fix `Lint/RedundantSafeNavigation` cop (#28172) --- app/controllers/api/v1/accounts_controller.rb | 2 +- app/models/trends/history.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 653529316f..be251b4259 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -49,7 +49,7 @@ class Api::V1::AccountsController < Api::BaseController end def mute - MuteService.new.call(current_user.account, @account, notifications: truthy_param?(:notifications), duration: (params[:duration]&.to_i || 0)) + MuteService.new.call(current_user.account, @account, notifications: truthy_param?(:notifications), duration: params[:duration].to_i) render json: @account, serializer: REST::RelationshipSerializer, relationships: relationships end diff --git a/app/models/trends/history.rb b/app/models/trends/history.rb index db36899337..21331f00dc 100644 --- a/app/models/trends/history.rb +++ b/app/models/trends/history.rb @@ -37,7 +37,7 @@ class Trends::History end def uses - with_redis { |redis| redis.get(key_for(:uses))&.to_i || 0 } + with_redis { |redis| redis.get(key_for(:uses)).to_i } end def add(account_id)