Compare commits

..

14 Commits

Author SHA1 Message Date
みてるぞ 6dedf4148d #61 2026-03-21 19:53:54 +09:00
みてるぞ 930d020f2a #61 2026-03-21 15:41:05 +09:00
みてるぞ 8ccefd9782 Merge remote-tracking branch 'origin/main' into feature/061 2026-03-18 23:02:40 +09:00
みてるぞ 0eab847ebb #61 2026-03-15 19:54:37 +09:00
みてるぞ e399707fbf #61 2026-03-15 19:53:11 +09:00
みてるぞ a7afe5f4d5 #61 2026-03-15 16:07:32 +09:00
みてるぞ cac4ad7f51 #61 2026-03-15 15:25:32 +09:00
みてるぞ be14ae3ee4 #61 2026-03-15 15:23:07 +09:00
みてるぞ 5581d6e1cc #61 2026-03-15 02:48:13 +09:00
みてるぞ 1b56176cac #61 2026-03-15 02:33:28 +09:00
みてるぞ ea61f4a047 #61 2026-03-15 02:26:24 +09:00
みてるぞ c24ffad7dd #61 2026-03-15 02:13:45 +09:00
みてるぞ f8e4da6fcb #61 2026-03-14 20:59:24 +09:00
みてるぞ 790f39e95b 日づけ不詳の表示修正 2026-03-14 18:32:19 +09:00
+5 -8
View File
@@ -2,8 +2,8 @@ class TagsController < ApplicationController
def index def index
post_id = params[:post] post_id = params[:post]
name = params[:name].to_s.strip.presence name = params[:name].presence
category = params[:category].to_s.strip.presence category = params[:category].presence
post_count_between = (params[:post_count_gte].presence || -1).to_i, post_count_between = (params[:post_count_gte].presence || -1).to_i,
(params[:post_count_lte].presence || -1).to_i (params[:post_count_lte].presence || -1).to_i
post_count_between[0] = nil if post_count_between[0] < 0 post_count_between[0] = nil if post_count_between[0] < 0
@@ -36,9 +36,7 @@ class TagsController < ApplicationController
.includes(:tag_name, tag_name: :wiki_page) .includes(:tag_name, tag_name: :wiki_page)
q = q.where(posts: { id: post_id }) if post_id.present? q = q.where(posts: { id: post_id }) if post_id.present?
if name q = q.where('tag_names.name LIKE ?', "%#{ name }%") if name
q = q.where('tag_names.name LIKE ?', "%#{ ActiveRecord::Base.sanitize_sql_like(name) }%")
end
q = q.where(category: category) if category q = q.where(category: category) if category
q = q.where('tags.post_count >= ?', post_count_between[0]) if post_count_between[0] q = q.where('tags.post_count >= ?', post_count_between[0]) if post_count_between[0]
q = q.where('tags.post_count <= ?', post_count_between[1]) if post_count_between[1] q = q.where('tags.post_count <= ?', post_count_between[1]) if post_count_between[1]
@@ -79,7 +77,7 @@ class TagsController < ApplicationController
alias_rows = alias_rows =
TagName TagName
.where('name LIKE ?', "#{ ActiveRecord::Base.sanitize_sql_like(q) }%") .where('name LIKE ?', "#{ q }%")
.where.not(canonical_id: nil) .where.not(canonical_id: nil)
.pluck(:canonical_id, :name) .pluck(:canonical_id, :name)
@@ -99,8 +97,7 @@ class TagsController < ApplicationController
base base
.where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') + .where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') +
'tag_names.name LIKE ?'), 'tag_names.name LIKE ?'),
*(with_nico ? ['nico', "nico:#{ ActiveRecord::Base.sanitise_sql_like(q) }%"] : []), *(with_nico ? ['nico', "nico:#{ q }%"] : []), "#{ q }%")
"#{ ActiveRecord::Base.sanitise_sql_like(q) }%")
tags = tags =
if canonical_ids.present? if canonical_ids.present?