chore: revert memoization patterns and redundant default values
- Disable Style/MemoizeInstanceVariable and Style/RedundantAssignment rules - Revert all instance_variable_defined? patterns back to ||= memoization - Restore || 0 and || 1 default values that were removed by RuboCop - Restore ternary operator formatting - Reduce PR from 35 to 18 files by removing cosmetic style changes
This commit is contained in:
@@ -24,11 +24,7 @@ class Api::V1::Accounts::CampaignsController < Api::V1::Accounts::BaseController
|
||||
private
|
||||
|
||||
def campaign
|
||||
if instance_variable_defined?(:@campaign)
|
||||
@campaign
|
||||
else
|
||||
@campaign = Current.account.campaigns.find_by(display_id: params[:id])
|
||||
end
|
||||
@campaign ||= Current.account.campaigns.find_by(display_id: params[:id])
|
||||
end
|
||||
|
||||
def campaign_params
|
||||
|
||||
@@ -39,11 +39,7 @@ class Api::V1::Accounts::CategoriesController < Api::V1::Accounts::BaseControlle
|
||||
end
|
||||
|
||||
def portal
|
||||
if instance_variable_defined?(:@portal)
|
||||
@portal
|
||||
else
|
||||
@portal = Current.account.portals.find_by(slug: params[:portal_id])
|
||||
end
|
||||
@portal ||= Current.account.portals.find_by(slug: params[:portal_id])
|
||||
end
|
||||
|
||||
def related_categories_records
|
||||
|
||||
@@ -13,10 +13,6 @@ class Api::V1::Accounts::Conversations::DirectUploadsController < ActiveStorage:
|
||||
private
|
||||
|
||||
def conversation
|
||||
if instance_variable_defined?(:@conversation)
|
||||
@conversation
|
||||
else
|
||||
@conversation = Current.account.conversations.find_by(display_id: params[:conversation_id])
|
||||
end
|
||||
@conversation ||= Current.account.conversations.find_by(display_id: params[:conversation_id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,11 +46,7 @@ class Api::V1::Accounts::Integrations::ShopifyController < Api::V1::Accounts::Ba
|
||||
end
|
||||
|
||||
def contact
|
||||
if instance_variable_defined?(:@contact)
|
||||
@contact
|
||||
else
|
||||
@contact = Current.account.contacts.find_by(id: params[:contact_id])
|
||||
end
|
||||
@contact ||= Current.account.contacts.find_by(id: params[:contact_id])
|
||||
end
|
||||
|
||||
def fetch_hook
|
||||
|
||||
@@ -25,11 +25,7 @@ class Api::V1::Widget::BaseController < ApplicationController
|
||||
end
|
||||
|
||||
def inbox
|
||||
if instance_variable_defined?(:@inbox)
|
||||
@inbox
|
||||
else
|
||||
@inbox = ::Inbox.find_by(id: auth_token_params[:inbox_id])
|
||||
end
|
||||
@inbox ||= ::Inbox.find_by(id: auth_token_params[:inbox_id])
|
||||
end
|
||||
|
||||
def conversation_params
|
||||
|
||||
Reference in New Issue
Block a user