gitlab-org--gitlab-foss/app/services/chat_names/find_user_service.rb
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00

30 lines
581 B
Ruby

# frozen_string_literal: true
module ChatNames
class FindUserService
def initialize(service, params)
@service = service
@params = params
end
def execute
chat_name = find_chat_name
return unless chat_name
chat_name.update_last_used_at
chat_name
end
private
# rubocop: disable CodeReuse/ActiveRecord
def find_chat_name
ChatName.find_by(
service: @service,
team_id: @params[:team_id],
chat_id: @params[:user_id]
)
end
# rubocop: enable CodeReuse/ActiveRecord
end
end