Merge pull request #6517 from artoscinote/ma_SCI_9574

Fix user smart annotations [SCI-9574]
This commit is contained in:
Martin Artnik 2023-10-23 13:37:49 +02:00 committed by GitHub
commit ebb2c7537b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -137,14 +137,13 @@ module ApplicationHelper
# and outputs a popover with user information # 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]+)\]/ sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/
new_text = text.gsub(sa_user) do |el| text.gsub(sa_user) do |el|
match = el.match(sa_user) match = el.match(sa_user)
user = User.find_by_id(match[2].base62_decode) user = User.find_by_id(match[2].base62_decode)
next unless user next unless user
popover_for_user_name(user, team, false, false, base64_encoded_imgs) popover_for_user_name(user, team, false, false, base64_encoded_imgs)
end end
sanitize_input(new_text)
end end
# Generate smart annotation link for one user object # Generate smart annotation link for one user object

View file

@ -18,8 +18,8 @@
data-placement="top" data-placement="top"
data-toggle="popover" data-toggle="popover"
data-content="" data-content=""
data-full-name="<%= user.full_name %>" data-full-name="<%= escape_input(user.full_name) %>"
data-email="<%= user.email %>" data-email="<%= escape_input(user.email) %>"
data-popover-html="<%= popover_html %>" data-popover-html="<%= popover_html %>"
data-user-avatar-popover-absolute-url="<%= user_avatar_absolute_url( data-user-avatar-popover-absolute-url="<%= user_avatar_absolute_url(
user, user,
@ -27,7 +27,7 @@
base64_encoded_imgs base64_encoded_imgs
) %>" ) %>"
> >
<%= user.full_name %> <%= escape_input(user.full_name) %>
</a> </a>
<% unless skip_user_status || user_still_in_team %> <% unless skip_user_status || user_still_in_team %>
<%= I18n.t('atwho.res.removed') %> <%= I18n.t('atwho.res.removed') %>