DEV: Add user_agent column to search_logs (#27742)

Add a new column - `user_agent` - to the `SearchLog` table. 

This column can be null as we are only allowing a the user-agent string to have a max length of 2000 characters. In the case the user-agent string surpasses the max characters allowed, we simply nullify the value, and save/write the log as normal.
This commit is contained in:
Isaac Janzen
2024-07-05 14:05:00 -05:00
committed by GitHub
parent b36cbc7d21
commit 005f623c42
5 changed files with 49 additions and 5 deletions

View File

@ -46,6 +46,7 @@ class SearchController < ApplicationController
search_args[:search_type] = :full_page
search_args[:ip_address] = request.remote_ip
search_args[:user_agent] = request.user_agent
search_args[:user_id] = current_user.id if current_user.present?
if rate_limit_search
@ -99,6 +100,7 @@ class SearchController < ApplicationController
search_args[:search_type] = :header
search_args[:ip_address] = request.remote_ip
search_args[:user_agent] = request.user_agent
search_args[:user_id] = current_user.id if current_user.present?
search_args[:restrict_to_archetype] = params[:restrict_to_archetype] if params[
:restrict_to_archetype