From fc77adf2bc3df59a29b7a268e06fac17cc574656 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 10 Aug 2022 14:48:47 +0200 Subject: [PATCH] Fix toggling of checklist items with smart annotations [SCI-7070] --- app/helpers/application_helper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fd6164783..cdf656c9f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -114,26 +114,26 @@ module ApplicationHelper def smart_annotation_parser(text, team = nil, base64_encoded_imgs = false, preview_repository = false) # sometimes happens that the "team" param gets wrong data: "{nil, []}" # so we have to check if the "team" param is kind of Team object - team = nil unless team.is_a? Team - new_text = smart_annotation_filter_resources(text, team, preview_repository) - new_text = smart_annotation_filter_users(new_text, team, base64_encoded_imgs) - new_text + team = nil unless team.is_a?(Team) + new_text = smart_annotation_filter_resources(text, team, preview_repository: preview_repository) + smart_annotation_filter_users(new_text, team, base64_encoded_imgs: base64_encoded_imgs) end # Check if text have smart annotations of resources # and outputs a link to resource - def smart_annotation_filter_resources(text, team, preview_repository = false) + def smart_annotation_filter_resources(text, team, preview_repository: false) user = if !defined?(current_user) && @user @user else current_user end + team ||= defined?(current_team) ? current_team : nil SmartAnnotations::TagToHtml.new(user, team, text, preview_repository).html end # Check if text have smart annotations of users # and outputs a popover with user information - def smart_annotation_filter_users(text, team, base64_encoded_imgs = false) + def smart_annotation_filter_users(text, team, base64_encoded_imgs: false) sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/ new_text = text.gsub(sa_user) do |el| match = el.match(sa_user)