Add ability to follow hashtags (#18809)
This commit is contained in:
parent
ecb3bb3256
commit
c3f0621a59
18 changed files with 329 additions and 20 deletions
15
app/presenters/tag_relationships_presenter.rb
Normal file
15
app/presenters/tag_relationships_presenter.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class TagRelationshipsPresenter
|
||||
attr_reader :following_map
|
||||
|
||||
def initialize(tags, current_account_id = nil, **options)
|
||||
@following_map = begin
|
||||
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
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue