gitlab-org--gitlab-foss/app/services/chat_names/find_user_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
601 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module ChatNames
class FindUserService
def initialize(integration, params)
@integration = integration
@params = params
end
def execute
2016-11-16 08:56:30 -05:00
chat_name = find_chat_name
return unless chat_name
chat_name.update_last_used_at
chat_name
2016-11-16 08:56:30 -05:00
end
private
# rubocop: disable CodeReuse/ActiveRecord
2016-11-16 08:56:30 -05:00
def find_chat_name
ChatName.find_by(
integration: @integration,
team_id: @params[:team_id],
chat_id: @params[:user_id]
)
end
# rubocop: enable CodeReuse/ActiveRecord
end
end