diff --git a/app/controllers/my_module_comments_controller.rb b/app/controllers/my_module_comments_controller.rb index aeecb0a6d..082671e99 100644 --- a/app/controllers/my_module_comments_controller.rb +++ b/app/controllers/my_module_comments_controller.rb @@ -43,12 +43,14 @@ class MyModuleCommentsController < ApplicationController end def create - @comment = Comment.new( + @comment = TaskComment.new( message: comment_params[:message], - user: current_user) + user: current_user, + my_module: @my_module + ) respond_to do |format| - if (@comment.valid? && @my_module.comments << @comment) + if @comment.save # Generate activity Activity.create( type_of: :add_comment_to_module, @@ -176,12 +178,12 @@ class MyModuleCommentsController < ApplicationController end def check_edit_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = TaskComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_edit_module_comment(@comment) end def check_destroy_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = TaskComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_delete_module_comment(@comment) end diff --git a/app/controllers/project_comments_controller.rb b/app/controllers/project_comments_controller.rb index 281e456a4..f0d259b5a 100644 --- a/app/controllers/project_comments_controller.rb +++ b/app/controllers/project_comments_controller.rb @@ -42,13 +42,14 @@ class ProjectCommentsController < ApplicationController end def create - @comment = Comment.new( + @comment = ProjectComment.new( message: comment_params[:message], - user: current_user) + user: current_user, + project: @project + ) respond_to do |format| - - if (@comment.valid? && @project.comments << @comment) + if @comment.save # Generate activity Activity.create( type_of: :add_comment_to_project, @@ -172,12 +173,12 @@ class ProjectCommentsController < ApplicationController end def check_edit_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = ProjectComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_edit_project_comment(@comment) end def check_destroy_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = ProjectComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_delete_project_comment(@comment) end diff --git a/app/controllers/result_comments_controller.rb b/app/controllers/result_comments_controller.rb index 400db80d9..0608852de 100644 --- a/app/controllers/result_comments_controller.rb +++ b/app/controllers/result_comments_controller.rb @@ -40,12 +40,14 @@ class ResultCommentsController < ApplicationController end def create - @comment = Comment.new( + @comment = ResultComment.new( message: comment_params[:message], - user: current_user) + user: current_user, + result: @result + ) respond_to do |format| - if (@comment.valid? && @result.comments << @comment) + if @comment.save # Generate activity Activity.create( @@ -54,7 +56,7 @@ class ResultCommentsController < ApplicationController project: @result.my_module.experiment.project, my_module: @result.my_module, message: t( - "activities.add_comment_to_result", + 'activities.add_comment_to_result', user: current_user.full_name, result: @result.name ) @@ -63,7 +65,7 @@ class ResultCommentsController < ApplicationController format.json { render json: { html: render_to_string( - partial: "comment.html.erb", + partial: 'comment.html.erb', locals: { comment: @comment } @@ -175,13 +177,13 @@ class ResultCommentsController < ApplicationController end def check_edit_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = ResultComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_edit_result_comment_in_module(@comment) end def check_destroy_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = ResultComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_delete_result_comment_in_module(@comment) end diff --git a/app/controllers/step_comments_controller.rb b/app/controllers/step_comments_controller.rb index 5c8ffbc17..9ecd28666 100644 --- a/app/controllers/step_comments_controller.rb +++ b/app/controllers/step_comments_controller.rb @@ -39,13 +39,14 @@ class StepCommentsController < ApplicationController end def create - @comment = Comment.new( + @comment = StepComment.new( message: comment_params[:message], - user: current_user) + user: current_user, + step: @step + ) respond_to do |format| - if (@comment.valid? && @step.comments << @comment) - + if @comment.save # Generate activity (this can only occur in module, # but nonetheless check if my module is not nil) if @protocol.in_module? @@ -183,13 +184,13 @@ class StepCommentsController < ApplicationController end def check_edit_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = StepComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_edit_step_comment_in_protocol(@comment) end def check_destroy_permissions - @comment = Comment.find_by_id(params[:id]) + @comment = StepComment.find_by_id(params[:id]) render_403 unless @comment.present? && can_delete_step_comment_in_protocol(@comment) end diff --git a/app/helpers/permission_helper.rb b/app/helpers/permission_helper.rb index ef110f289..a65b6dc1e 100644 --- a/app/helpers/permission_helper.rb +++ b/app/helpers/permission_helper.rb @@ -314,18 +314,18 @@ module PermissionHelper end def can_edit_project_comment(comment) - comment.project_comment.present? && + comment.project.present? && ( comment.user == current_user || - is_owner_of_project(comment.project_comment.project) + is_owner_of_project(comment.project) ) end def can_delete_project_comment(comment) - comment.project_comment.present? && + comment.project.present? && ( comment.user == current_user || - is_owner_of_project(comment.project_comment.project) + is_owner_of_project(comment.project) ) end @@ -503,21 +503,21 @@ module PermissionHelper end def can_edit_module_comment(comment) - comment.my_module_comment.present? && + comment.my_module.present? && ( comment.user == current_user || is_owner_of_project( - comment.my_module_comment.my_module.experiment.project + comment.my_module.experiment.project ) ) end def can_delete_module_comment(comment) - comment.my_module_comment.present? && + comment.my_module.present? && ( comment.user == current_user || is_owner_of_project( - comment.my_module_comment.my_module.experiment.project + comment.my_module.experiment.project ) ) end @@ -555,21 +555,21 @@ module PermissionHelper end def can_edit_result_comment_in_module(comment) - comment.result_comment.present? && + comment.result.present? && ( comment.user == current_user || is_owner_of_project( - comment.result_comment.result.my_module.experiment.project + comment.result.my_module.experiment.project ) ) end def can_delete_result_comment_in_module(comment) - comment.result_comment.present? && + comment.result.present? && ( comment.user == current_user || is_owner_of_project( - comment.result_comment.result.my_module.experiment.project + comment.result.my_module.experiment.project ) ) end @@ -953,9 +953,9 @@ module PermissionHelper end def can_edit_step_comment_in_protocol(comment) - return false if comment.step_comment.blank? + return false if comment.step.blank? - protocol = comment.step_comment.step.protocol + protocol = comment.step.protocol if protocol.in_module? comment.user == current_user || is_owner_of_project( @@ -967,9 +967,9 @@ module PermissionHelper end def can_delete_step_comment_in_protocol(comment) - return false if comment.step_comment.blank? + return false if comment.step.blank? - protocol = comment.step_comment.step.protocol + protocol = comment.step.protocol if protocol.in_module? comment.user == current_user || is_owner_of_project( diff --git a/app/models/comment.rb b/app/models/comment.rb index 95c02f5ed..595e4f707 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -7,16 +7,9 @@ class Comment < ActiveRecord::Base length: { maximum: Constants::TEXT_MAX_LENGTH } validates :user, presence: true - validate :belongs_to_only_one_object - belongs_to :user, inverse_of: :comments - belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User' - - has_one :step_comment, inverse_of: :comment, dependent: :destroy - has_one :my_module_comment, inverse_of: :comment, dependent: :destroy - has_one :result_comment, inverse_of: :comment, dependent: :destroy - has_one :sample_comment, inverse_of: :comment, dependent: :destroy - has_one :project_comment, inverse_of: :comment, dependent: :destroy + belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', + class_name: 'User' def self.search( user, @@ -27,52 +20,44 @@ class Comment < ActiveRecord::Base project_ids = Project .search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT) - .select("id") + .select(:id) my_module_ids = MyModule .search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT) - .select("id") + .select(:id) step_ids = Step .search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT) - .select("id") + .select(:id) result_ids = Result .search(user, include_archived, nil, Constants::SEARCH_NO_LIMIT) - .select("id") - + .select(:id) if query a_query = query.strip - .gsub("_","\\_") - .gsub("%","\\%") - .split(/\s+/) - .map {|t| "%" + t + "%" } + .gsub('_', '\\_') + .gsub('%', '\\%') + .split(/\s+/) + .map { |t| '%' + t + '%' } else a_query = query end - new_query = Comment - .distinct - .joins(:user) - .joins("LEFT JOIN project_comments ON project_comments.comment_id = comments.id") - .joins("LEFT JOIN my_module_comments ON my_module_comments.comment_id = comments.id") - .joins("LEFT JOIN step_comments ON step_comments.comment_id = comments.id") - .joins("LEFT JOIN result_comments ON result_comments.comment_id = comments.id") - .where( - "project_comments.project_id IN (?) OR " + - "my_module_comments.my_module_id IN (?) OR " + - "step_comments.step_id IN (?) OR " + - "result_comments.result_id IN (?)", - project_ids, - my_module_ids, - step_ids, - result_ids - ) - .where_attributes_like( - [ :message, "users.full_name" ], - a_query - ) + new_query = + Comment.distinct + .joins(:user) + .where( + '(comments.associated_id IN (?) AND comments.type = ?) OR ' \ + '(comments.associated_id IN (?) AND comments.type = ?) OR ' \ + '(comments.associated_id IN (?) AND comments.type = ?) OR ' \ + '(comments.associated_id IN (?) AND comments.type = ?)', + project_ids, 'ProjectComment', + my_module_ids, 'TaskComment', + step_ids, 'StepComment', + result_ids, 'ResultComment' + ) + .where_attributes_like([:message, 'users.full_name'], a_query) # Show all results if needed if page == Constants::SEARCH_NO_LIMIT @@ -83,21 +68,4 @@ class Comment < ActiveRecord::Base .offset((page - 1) * Constants::SEARCH_LIMIT) end end - - private - - def belongs_to_only_one_object - # We must allow all elements to be blank because of GUI - # (eventhough it's not really a "valid" comment) - cntr = 0 - cntr += 1 if step_comment.present? - cntr += 1 if my_module_comment.present? - cntr += 1 if result_comment.present? - cntr += 1 if sample_comment.present? - cntr += 1 if project_comment.present? - - if cntr > 1 - errors.add(:base, "Comment can only belong to 1 'parent' object.") - end - end end diff --git a/app/models/my_module.rb b/app/models/my_module.rb index ddcb74e81..99be7b97f 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -23,8 +23,7 @@ class MyModule < ActiveRecord::Base has_many :results, inverse_of: :my_module, :dependent => :destroy has_many :my_module_tags, inverse_of: :my_module, :dependent => :destroy has_many :tags, through: :my_module_tags - has_many :my_module_comments, inverse_of: :my_module, :dependent => :destroy - has_many :comments, through: :my_module_comments + has_many :task_comments, foreign_key: :associated_id, dependent: :destroy has_many :inputs, :class_name => 'Connection', :foreign_key => "input_id", inverse_of: :to, :dependent => :destroy has_many :outputs, :class_name => 'Connection', :foreign_key => "output_id", inverse_of: :from, :dependent => :destroy has_many :my_modules, through: :outputs, source: :to @@ -176,11 +175,11 @@ class MyModule < ActiveRecord::Base # using last comment id and per_page parameters. def last_comments(last_id = 1, per_page = Constants::COMMENTS_SEARCH_LIMIT) last_id = Constants::INFINITY if last_id <= 1 - comments = Comment.joins(:my_module_comment) - .where(my_module_comments: { my_module_id: id }) - .where('comments.id < ?', last_id) - .order(created_at: :desc) - .limit(per_page) + comments = TaskComment.joins(:my_module) + .where(my_modules: { id: id }) + .where('comments.id < ?', last_id) + .order(created_at: :desc) + .limit(per_page) comments.reverse end diff --git a/app/models/my_module_comment.rb b/app/models/my_module_comment.rb deleted file mode 100644 index 7f0eaea11..000000000 --- a/app/models/my_module_comment.rb +++ /dev/null @@ -1,7 +0,0 @@ -class MyModuleComment < ActiveRecord::Base - validates :comment, :my_module, presence: true - validates :my_module_id, uniqueness: { scope: :comment_id } - - belongs_to :comment, inverse_of: :my_module_comment - belongs_to :my_module, inverse_of: :my_module_comments -end diff --git a/app/models/project.rb b/app/models/project.rb index ad1a3649b..dd9f12186 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -19,8 +19,7 @@ class Project < ActiveRecord::Base has_many :user_projects, inverse_of: :project has_many :users, through: :user_projects has_many :experiments, inverse_of: :project - has_many :project_comments, inverse_of: :project - has_many :comments, through: :project_comments + has_many :project_comments, foreign_key: :associated_id, dependent: :destroy has_many :activities, inverse_of: :project has_many :tags, inverse_of: :project has_many :reports, inverse_of: :project, dependent: :destroy @@ -110,11 +109,11 @@ class Project < ActiveRecord::Base # using last comment id and per_page parameters. def last_comments(last_id = 1, per_page = Constants::COMMENTS_SEARCH_LIMIT) last_id = Constants::INFINITY if last_id <= 1 - comments = Comment.joins(:project_comment) - .where(project_comments: { project_id: id }) - .where('comments.id < ?', last_id) - .order(created_at: :desc) - .limit(per_page) + comments = ProjectComment.joins(:project) + .where(projects: { id: id }) + .where('comments.id < ?', last_id) + .order(created_at: :desc) + .limit(per_page) comments.reverse end diff --git a/app/models/project_comment.rb b/app/models/project_comment.rb index 151564a63..2b2b6b847 100644 --- a/app/models/project_comment.rb +++ b/app/models/project_comment.rb @@ -1,7 +1,5 @@ -class ProjectComment < ActiveRecord::Base - validates :comment, :project, presence: true - validates :project_id, uniqueness: { scope: :comment_id } +class ProjectComment < Comment + belongs_to :project, foreign_key: :associated_id - belongs_to :comment, inverse_of: :project_comment - belongs_to :project, inverse_of: :project_comments + validates :project, presence: true end diff --git a/app/models/result.rb b/app/models/result.rb index 84961f986..46faa38a7 100644 --- a/app/models/result.rb +++ b/app/models/result.rb @@ -22,10 +22,7 @@ class Result < ActiveRecord::Base has_one :result_text, inverse_of: :result, dependent: :destroy - has_many :result_comments, - inverse_of: :result, - dependent: :destroy - has_many :comments, through: :result_comments + has_many :result_comments, foreign_key: :associated_id, dependent: :destroy has_many :report_elements, inverse_of: :result, dependent: :destroy accepts_nested_attributes_for :result_text @@ -74,11 +71,11 @@ class Result < ActiveRecord::Base def last_comments(last_id = 1, per_page = Constants::COMMENTS_SEARCH_LIMIT) last_id = Constants::INFINITY if last_id <= 1 - comments = Comment.joins(:result_comment) - .where(result_comments: { result_id: id }) - .where('comments.id < ?', last_id) - .order(created_at: :desc) - .limit(per_page) + comments = ResultComment.joins(:result) + .where(results: { id: id }) + .where('comments.id < ?', last_id) + .order(created_at: :desc) + .limit(per_page) comments.reverse end diff --git a/app/models/result_comment.rb b/app/models/result_comment.rb index 3c8ffc940..e00fa6fd2 100644 --- a/app/models/result_comment.rb +++ b/app/models/result_comment.rb @@ -1,7 +1,5 @@ -class ResultComment < ActiveRecord::Base - validates :result, :comment, presence: true - validates :result_id, uniqueness: { scope: :comment_id } +class ResultComment < Comment + belongs_to :result, foreign_key: :associated_id - belongs_to :result, inverse_of: :result_comments - belongs_to :comment, inverse_of: :result_comment + validates :result, presence: true end diff --git a/app/models/sample.rb b/app/models/sample.rb index 54f3ee496..b0d26b907 100644 --- a/app/models/sample.rb +++ b/app/models/sample.rb @@ -14,8 +14,6 @@ class Sample < ActiveRecord::Base belongs_to :sample_type, inverse_of: :samples has_many :sample_my_modules, inverse_of: :sample, dependent: :destroy has_many :my_modules, through: :sample_my_modules - has_many :sample_comments, inverse_of: :sample, dependent: :destroy - has_many :comments, through: :sample_comments, dependent: :destroy has_many :sample_custom_fields, inverse_of: :sample, dependent: :destroy has_many :custom_fields, through: :sample_custom_fields diff --git a/app/models/sample_comment.rb b/app/models/sample_comment.rb deleted file mode 100644 index 489a61c6a..000000000 --- a/app/models/sample_comment.rb +++ /dev/null @@ -1,7 +0,0 @@ -class SampleComment < ActiveRecord::Base - validates :comment, :sample, presence: true - validates :sample_id, uniqueness: { scope: :comment_id } - - belongs_to :comment, inverse_of: :sample_comment - belongs_to :sample, inverse_of: :sample_comments -end diff --git a/app/models/step.rb b/app/models/step.rb index 97c17edac..549a518dc 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -16,9 +16,7 @@ class Step < ActiveRecord::Base belongs_to :protocol, inverse_of: :steps has_many :checklists, inverse_of: :step, dependent: :destroy - has_many :step_comments, inverse_of: :step, - dependent: :destroy - has_many :comments, through: :step_comments + has_many :step_comments, foreign_key: :associated_id, dependent: :destroy has_many :step_assets, inverse_of: :step, dependent: :destroy has_many :assets, through: :step_assets @@ -77,9 +75,8 @@ class Step < ActiveRecord::Base def destroy(current_user) @current_user = current_user - # Store IDs of comments, assets & tables so they + # Store IDs of assets & tables so they # can be destroyed in after_destroy - @c_ids = self.comments.collect { |c| c.id } @a_ids = self.assets.collect { |a| a.id } @t_ids = self.tables.collect { |t| t.id } @@ -92,11 +89,11 @@ class Step < ActiveRecord::Base def last_comments(last_id = 1, per_page = Constants::COMMENTS_SEARCH_LIMIT) last_id = Constants::INFINITY if last_id <= 1 - comments = Comment.joins(:step_comment) - .where(step_comments: { step_id: id }) - .where('comments.id < ?', last_id) - .order(created_at: :desc) - .limit(per_page) + comments = StepComment.joins(:step) + .where(steps: { id: id }) + .where('comments.id < ?', last_id) + .order(created_at: :desc) + .limit(per_page) comments.reverse end @@ -116,8 +113,6 @@ class Step < ActiveRecord::Base protected def cascade_after_destroy - Comment.destroy(@c_ids) - @c_ids = nil # Assets already deleted by here @a_ids = nil Table.destroy(@t_ids) diff --git a/app/models/step_comment.rb b/app/models/step_comment.rb index c3154a47c..528d7b68c 100644 --- a/app/models/step_comment.rb +++ b/app/models/step_comment.rb @@ -1,7 +1,5 @@ -class StepComment < ActiveRecord::Base - validates :comment, :step, presence: true - validates :step_id, uniqueness: { scope: :comment_id } +class StepComment < Comment + belongs_to :step, foreign_key: :associated_id - belongs_to :comment, inverse_of: :step_comment - belongs_to :step, inverse_of: :step_comments + validates :step, presence: true end diff --git a/app/models/task_comment.rb b/app/models/task_comment.rb new file mode 100644 index 000000000..9ba2f92d3 --- /dev/null +++ b/app/models/task_comment.rb @@ -0,0 +1,5 @@ +class TaskComment < Comment + belongs_to :my_module, foreign_key: :associated_id + + validates :my_module, presence: true +end diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index 2bbb2e7a4..82a480e7f 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -946,10 +946,11 @@ module FirstTimeDataGenerator def generate_project_comment(project, user, message, created_at = nil) created_at ||= generate_random_time(project.created_at, 1.week) - project.comments << Comment.create( + ProjectComment.create( user: user, message: message, - created_at: created_at + created_at: created_at, + project: project ) Activity.new( type_of: :add_comment_to_project, @@ -964,10 +965,11 @@ module FirstTimeDataGenerator def generate_module_comment(my_module, user, message, created_at = nil) created_at ||= generate_random_time(my_module.created_at, 1.day) - my_module.comments << Comment.create( + TaskComment.create( user: user, message: message, - created_at: created_at + created_at: created_at, + my_module: my_module ) Activity.new( type_of: :add_comment_to_module, @@ -983,10 +985,11 @@ module FirstTimeDataGenerator def generate_result_comment(result, user, message, created_at = nil) created_at ||= generate_random_time(result.created_at, 1.days) - result.comments << Comment.new( + ResultComment.new( user: user, message: message, - created_at: created_at + created_at: created_at, + result: result ) Activity.new( type_of: :add_comment_to_result, @@ -1002,10 +1005,11 @@ module FirstTimeDataGenerator def generate_step_comment(step, user, message, created_at = nil) created_at ||= generate_random_time(step.created_at, 2.hours) - step.comments << Comment.new( + StepComment.new( user: user, message: message, - created_at: created_at + created_at: created_at, + step: step ) Activity.new( type_of: :add_comment_to_step, diff --git a/app/views/comments/_edit.html.erb b/app/views/comments/_edit.html.erb index 7937fea75..cbf174bdc 100644 --- a/app/views/comments/_edit.html.erb +++ b/app/views/comments/_edit.html.erb @@ -1,4 +1,4 @@ -<%= bootstrap_form_for(@comment, url: @update_url, remote: true, html: { method: :put, class: 'comment-form edit-comment-form' }, data: { role: 'edit-comment-message-form' }) do |f| %> +<%= bootstrap_form_for(:comment, url: @update_url, remote: true, html: { method: :put, class: 'comment-form edit-comment-form' }, data: { role: 'edit-comment-message-form' }) do |f| %>
- <% if comment.project_comment.present? %> + <% if comment.is_a?(ProjectComment) && comment.project.present? %> <%=t "search.index.comments.project" %> - <% elsif comment.my_module_comment.present? %> + <% elsif comment.is_a?(TaskComment) && comment.my_module.present? %> <%=t "search.index.comments.my_module" %> - <% elsif comment.step_comment.present? %> + <% elsif comment.is_a?(StepComment) && comment.step.present? %> <%=t "search.index.comments.step" %> - <% elsif comment.result_comment.present? %> + <% elsif comment.is_a?(ResultComment) && comment.result.present? %> <%=t "search.index.comments.result" %> <% end %>
@@ -31,29 +31,29 @@- <% if comment.project_comment.present? %> + <% if comment.is_a?(ProjectComment) && comment.project.present? %> <%=t "search.index.project" %> <%= render partial: "search/results/partials/project_text.html.erb", - locals: { project: comment.project_comment.project, link_to_page: :root } %> + locals: { project: comment.project, link_to_page: :root } %> - <% elsif comment.my_module_comment.present? %> + <% elsif comment.is_a?(TaskComment) && comment.my_module.present? %> <%=t "search.index.module" %> <%= render partial: "search/results/partials/my_module_text.html.erb", - locals: { my_module: comment.my_module_comment.my_module, link_to_page: :canvas } %> + locals: { my_module: comment.my_module, link_to_page: :canvas } %> - <% elsif comment.step_comment.present? %> + <% elsif comment.is_a?(StepComment) && comment.step.present? %> <%=t "search.index.step" %> <%= render partial: "search/results/partials/step_text.html.erb", - locals: { step: comment.step_comment.step, target: :comment } %> + locals: { step: comment.step, target: :comment } %> - <% elsif comment.result_comment.present? %> + <% elsif comment.is_a?(ResultComment) && comment.result.present? %> <%=t "search.index.result" %> <%= render partial: "search/results/partials/result_text.html.erb", - locals: { result: comment.result_comment.result, target: :comment } %> + locals: { result: comment.result, target: :comment } %> <% end %>
diff --git a/app/views/step_comments/_comment.html.erb b/app/views/step_comments/_comment.html.erb index 7fb8546c3..0f8c6ecf3 100644 --- a/app/views/step_comments/_comment.html.erb +++ b/app/views/step_comments/_comment.html.erb @@ -20,7 +20,7 @@