mirror of
https://github.com/mastodon/mastodon.git
synced 2024-10-20 16:46:08 +00:00
14 lines
487 B
Ruby
14 lines
487 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TagRelationshipsPresenter
|
|
attr_reader :following_map
|
|
|
|
def initialize(tags, current_account_id = nil, **options)
|
|
@following_map = if current_account_id.nil?
|
|
{}
|
|
else
|
|
TagFollow.select(:tag_id).where(tag_id: tags.map(&:id), account_id: current_account_id).each_with_object({}) { |f, h| h[f.tag_id] = true }.merge(options[:following_map] || {})
|
|
end
|
|
end
|
|
end
|