feat: 別名を検索に展開(#20) (#243)
#20 #20 テスト・ケースのみ追記 #20 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #243
This commit was merged in pull request #243.
This commit is contained in:
@@ -97,6 +97,8 @@ class PostsController < ApplicationController
|
||||
tags = Tag.normalise_tags(tag_names)
|
||||
tags = Tag.expand_parent_tags(tags)
|
||||
sync_post_tags!(post, tags)
|
||||
|
||||
post.reload
|
||||
render json: post.as_json(include: { tags: { only: [:id, :category, :post_count],
|
||||
methods: [:name, :has_wiki] } }),
|
||||
status: :created
|
||||
@@ -136,6 +138,8 @@ class PostsController < ApplicationController
|
||||
Tag.normalise_tags(tag_names, with_tagme: false)
|
||||
tags = Tag.expand_parent_tags(tags)
|
||||
sync_post_tags!(post, tags)
|
||||
|
||||
post.reload
|
||||
json = post.as_json
|
||||
json['tags'] = build_tag_tree_for(post.tags)
|
||||
render json:, status: :ok
|
||||
@@ -197,6 +201,8 @@ class PostsController < ApplicationController
|
||||
end
|
||||
|
||||
def filter_posts_by_tags tag_names, match_type
|
||||
tag_names = TagName.canonicalise(tag_names)
|
||||
|
||||
posts = Post.joins(tags: :tag_name)
|
||||
|
||||
if match_type == 'any'
|
||||
|
||||
Reference in New Issue
Block a user