このコミットが含まれているのは:
2026-06-22 21:24:55 +09:00
コミット d3af4563ca
12個のファイルの変更309行の追加47行の削除
+11 -3
ファイルの表示
@@ -18,7 +18,7 @@ module PostRepr
def base post, current_user = nil
json = common(post)
json['tags'] = tag_json(post.tags)
json['tags'] = tag_json(post)
json['uploaded_user'] = post.uploaded_user && UserRepr.base(post.uploaded_user)
json['viewed'] = current_user ? current_user.viewed?(post) : false
json
@@ -52,8 +52,16 @@ module PostRepr
.merge('thumbnail' => thumbnail_url(post))
end
def tag_json tags
tags.reject(&:deprecated?).map { |tag| TagRepr.inline(tag) }
def tag_json post
post
.active_post_tags
.reject { _1.tag.deprecated? }
.sort_by { _1.tag.name }
.map { |post_tag|
TagRepr.inline(post_tag.tag).merge(
'children' => [],
'sections' => post_tag.sections.as_json(only: [:begin_ms, :end_ms]))
}
end
def thumbnail_url post