From 2e5c358af8e0ee06862331c93c8d749601bb882b Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 21 Mar 2025 12:56:51 +0100 Subject: [PATCH] Handle non-existant smart anotation records [SCI-11695] --- app/controllers/smart_annotations_controller.rb | 16 +++------------- config/routes.rb | 6 ------ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/controllers/smart_annotations_controller.rb b/app/controllers/smart_annotations_controller.rb index 0e87fede4..239cbd1b7 100644 --- a/app/controllers/smart_annotations_controller.rb +++ b/app/controllers/smart_annotations_controller.rb @@ -5,17 +5,6 @@ class SmartAnnotationsController < ApplicationController include ActionView::Helpers::TextHelper include ApplicationHelper - def parse_string - render json: { - annotations: custom_auto_link( - params[:string], - simple_format: false, - tags: %w(img), - team: current_team - ) - } - end - def show if params[:data] render json: { @@ -29,7 +18,6 @@ class SmartAnnotationsController < ApplicationController def user user_team_assignment = resource.user_assignments.find_by(assignable: current_team) - render json: { name: resource.name, email: resource.email, @@ -72,10 +60,12 @@ class SmartAnnotationsController < ApplicationController RepositoryRow end - @resource ||= resource_class.find(resource_id) + @resource ||= resource_class.find_by(id: resource_id) end def resource_readable? + return false unless resource + @resource_readable ||= case resource when RepositoryRow diff --git a/config/routes.rb b/config/routes.rb index bc8148315..f96be1169 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,12 +86,6 @@ Rails.application.routes.draw do get :update_progress_modal, on: :member end - resource :smart_annotations, only: [] do - collection do - post :parse_string - end - end - get 'users/settings/account/connected_accounts', to: 'users/settings/account/connected_accounts#index', as: 'connected_accounts'