Browse Source

#128 完了

feature/128
みてるぞ 2 days ago
parent
commit
221d816c16
3 changed files with 4 additions and 3 deletions
  1. +2
    -1
      backend/app/controllers/posts_controller.rb
  2. +1
    -1
      backend/app/models/tag.rb
  3. +1
    -1
      backend/lib/tasks/sync_nico.rake

+ 2
- 1
backend/app/controllers/posts_controller.rb View File

@@ -110,7 +110,8 @@ class PostsController < ApplicationController
original_created_before = params[:original_created_before] original_created_before = params[:original_created_before]


post = Post.find(params[:id].to_i) post = Post.find(params[:id].to_i)
tags = post.tags.where(category: 'nico').to_a + Tag.normalise_tags(tag_names)
tags = post.tags.where(category: 'nico').to_a +
Tag.normalise_tags(tag_names, with_tagme: false)
if post.update(title:, tags:, original_created_from:, original_created_before:) if post.update(title:, tags:, original_created_from:, original_created_before:)
render json: post.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }), render json: post.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }),
status: :ok status: :ok


+ 1
- 1
backend/app/models/tag.rb View File

@@ -57,7 +57,7 @@ class Tag < ApplicationRecord
end end
end end
end end
tags << Tag.tagme if with_tagme && tags.size < 20 && tags.none?(Tag.tagme)
tags << Tag.tagme if with_tagme && tags.size < 10 && tags.none?(Tag.tagme)
tags.uniq tags.uniq
end end




+ 1
- 1
backend/lib/tasks/sync_nico.rake View File

@@ -51,7 +51,7 @@ namespace :nico do
end end
tags_to_add.concat([tag] + tag.linked_tags) tags_to_add.concat([tag] + tag.linked_tags)
end end
tags_to_add << Tag.tagme if post.tags.size < 20
tags_to_add << Tag.tagme if post.tags.size < 10
tags_to_add << Tag.bot tags_to_add << Tag.bot
post.tags = (post.tags + tags_to_add).uniq post.tags = (post.tags + tags_to_add).uniq
end end


Loading…
Cancel
Save