Sha256: 2651ab8fa37edc6c4915b05ac7f6df81ec1420866736c1f67db72eeca919c2c6
Contents?: true
Size: 828 Bytes
Versions: 4
Compression:
Stored size: 828 Bytes
Contents
# frozen_string_literal: true require_dependency 'html/pipeline/at_mention_filter' module Thredded class AtNotificationExtractor def initialize(post) @post = post end # @return [Array<Thredded.user_class>] def run view_context = Thredded::ApplicationController.new.view_context # Do not highlight @-mentions at first, because: # * When parsing, @-mentions within <a> tags will not be considered. # * We can't always generate the user URL here because request.host is not available. html = @post.filtered_content(view_context, users_provider: nil) HTML::Pipeline::AtMentionFilter.new( html, view_context: view_context, users_provider: -> (user_names) { @post.readers_from_user_names(user_names).to_a } ).mentioned_users end end end
Version data entries
4 entries across 4 versions & 1 rubygems