mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-18 19:14:45 +08:00
Merge pull request #6517 from artoscinote/ma_SCI_9574
Fix user smart annotations [SCI-9574]
This commit is contained in:
commit
ebb2c7537b
2 changed files with 5 additions and 6 deletions
|
@ -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
|
||||||
|
|
|
@ -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') %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue