diff --git a/app/controllers/models_controller.rb b/app/controllers/models_controller.rb index 64a1d8964..694f2c06e 100644 --- a/app/controllers/models_controller.rb +++ b/app/controllers/models_controller.rb @@ -4,6 +4,7 @@ class ModelsController < ApplicationController include ModelListable include Permittable + before_action :redirect_search, only: [:index], if: -> { params.key?(:q) } before_action :get_model, except: [:bulk_edit, :bulk_update, :index, :new, :create] before_action :get_creators_and_collections, only: [:new, :edit, :bulk_edit] before_action :set_returnable, only: [:bulk_edit, :edit, :new] @@ -172,6 +173,10 @@ def destroy private + def redirect_search + redirect_to new_follow_path(uri: params[:q]) if params[:q]&.match?(/(@|acct:)?(?[a-z0-9\-_.]+)(?:@(?.*))/) + end + def generate_available_tag_list @available_tags = ActsAsTaggableOn::Tag.where( id: ActsAsTaggableOn::Tagging.where(