Sha256: ea30cba1afbe4e4538f00d2b39646125bc696df9137934a117943c5f526f1c78

Contents?: true

Size: 783 Bytes

Versions: 26

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

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)
      Thredded::HtmlPipeline::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

26 entries across 26 versions & 2 rubygems

Version Path
thredded-0.13.2 app/commands/thredded/at_notification_extractor.rb
thredded-0.13.1 app/commands/thredded/at_notification_extractor.rb
thredded-0.13.0 app/commands/thredded/at_notification_extractor.rb
thredded-0.12.4 app/commands/thredded/at_notification_extractor.rb
thredded-0.12.3 app/commands/thredded/at_notification_extractor.rb
thredded-0.12.2 app/commands/thredded/at_notification_extractor.rb