このコミットが含まれているのは:
@@ -121,9 +121,11 @@ class PostCreator
|
||||
def sync_post_tags! post, desired_tags, sections
|
||||
desired_ids = desired_tags.map(&:id).to_set
|
||||
current_ids = post.tags.pluck(:id).to_set
|
||||
|
||||
Tag.where(id: desired_ids - current_ids).find_each do |tag|
|
||||
PostTag.create_or_find_by!(post:, tag:, created_user: @actor)
|
||||
end
|
||||
|
||||
PostTagSection.where(post_id: post.id).destroy_all
|
||||
sections.each do |tag_id, ranges|
|
||||
ranges.each do |begin_ms, end_ms|
|
||||
@@ -133,10 +135,9 @@ class PostCreator
|
||||
end_ms:)
|
||||
end
|
||||
end
|
||||
|
||||
PostTag.where(post_id: post.id,
|
||||
tag_id: (current_ids - desired_ids).to_a).kept.find_each do |post_tag|
|
||||
post_tag.discard_by!(@actor)
|
||||
end
|
||||
tag_id: (current_ids - desired_ids).to_a).destroy_all
|
||||
end
|
||||
|
||||
def sync_parent_posts! post, ids
|
||||
|
||||
@@ -103,7 +103,7 @@ module Youtube
|
||||
end
|
||||
|
||||
def sync_post_tags! post, desired_tag_ids, current_tag_ids: nil
|
||||
current_tag_ids ||= PostTag.kept.where(post_id: post.id).pluck(:tag_id).to_set
|
||||
current_tag_ids ||= PostTag.where(post_id: post.id).pluck(:tag_id).to_set
|
||||
desired_tag_ids = desired_tag_ids.compact.to_set
|
||||
|
||||
to_add = desired_tag_ids - current_tag_ids
|
||||
@@ -117,8 +117,8 @@ module Youtube
|
||||
end
|
||||
end
|
||||
|
||||
PostTag.where(post_id: post.id, tag_id: to_remove.to_a).kept.find_each do |pt|
|
||||
pt.discard_by!(nil)
|
||||
PostTag.where(post_id: post.id, tag_id: to_remove.to_a).find_each do |pt|
|
||||
pt.destroy!
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする