We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef3fa77 commit a503b00Copy full SHA for a503b00
1 file changed
app/helpers/comments_helper.rb
@@ -34,18 +34,11 @@ def comment_user_link(comment)
34
user_link(comment.user, { host: comment.community.host })
35
end
36
37
- # Gets a list of pinged user IDs from a given content
38
- # @param content [String] content to get pinged user IDs from
39
- # @return [Array<String>] list of pinged user IDs
40
- def pinged_user_ids(content)
41
- content.scan(/@#(\d+)/).map { |g| g[0].to_i }
42
- end
43
-
44
# Gets a list of pinged users for a given content
45
# @param content [String] content to get pinged users from
46
# @return [Hash{String => User}] list of pinged users
47
def pinged_users(content)
48
- user_ids = pinged_user_ids(content)
+ user_ids = content.scan(/@#(\d+)/).map { |g| g[0].to_i }
49
User.where(id: user_ids).to_a.to_h { |u| [u.id, u] }
50
51
0 commit comments