コミットを比較
12 コミット
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 8ccefd9782 | |||
| 0eab847ebb | |||
| e399707fbf | |||
| a7afe5f4d5 | |||
| cac4ad7f51 | |||
| be14ae3ee4 | |||
| 5581d6e1cc | |||
| 1b56176cac | |||
| ea61f4a047 | |||
| c24ffad7dd | |||
| f8e4da6fcb | |||
| 790f39e95b |
@@ -2,8 +2,8 @@ class TagsController < ApplicationController
|
||||
def index
|
||||
post_id = params[:post]
|
||||
|
||||
name = params[:name].to_s.strip.presence
|
||||
category = params[:category].to_s.strip.presence
|
||||
name = params[:name].presence
|
||||
category = params[:category].presence
|
||||
post_count_between = (params[:post_count_gte].presence || -1).to_i,
|
||||
(params[:post_count_lte].presence || -1).to_i
|
||||
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)
|
||||
q = q.where(posts: { id: post_id }) if post_id.present?
|
||||
|
||||
if name
|
||||
q = q.where('tag_names.name LIKE ?', "%#{ ActiveRecord::Base.sanitize_sql_like(name) }%")
|
||||
end
|
||||
q = q.where('tag_names.name LIKE ?', "%#{ name }%") if name
|
||||
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[1]) if post_count_between[1]
|
||||
@@ -79,7 +77,7 @@ class TagsController < ApplicationController
|
||||
|
||||
alias_rows =
|
||||
TagName
|
||||
.where('name LIKE ?', "#{ ActiveRecord::Base.sanitize_sql_like(q) }%")
|
||||
.where('name LIKE ?', "#{ q }%")
|
||||
.where.not(canonical_id: nil)
|
||||
.pluck(:canonical_id, :name)
|
||||
|
||||
@@ -99,8 +97,7 @@ class TagsController < ApplicationController
|
||||
base
|
||||
.where(((with_nico ? '(tags.category = ? AND tag_names.name LIKE ?) OR ' : '') +
|
||||
'tag_names.name LIKE ?'),
|
||||
*(with_nico ? ['nico', "nico:#{ ActiveRecord::Base.sanitise_sql_like(q) }%"] : []),
|
||||
"#{ ActiveRecord::Base.sanitise_sql_like(q) }%")
|
||||
*(with_nico ? ['nico', "nico:#{ q }%"] : []), "#{ q }%")
|
||||
|
||||
tags =
|
||||
if canonical_ids.present?
|
||||
|
||||
@@ -6,7 +6,6 @@ import { DndContext,
|
||||
useSensor,
|
||||
useSensors } from '@dnd-kit/core'
|
||||
import { restrictToWindowEdges } from '@dnd-kit/modifiers'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { motion } from 'framer-motion'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
|
||||
@@ -20,7 +19,6 @@ import SidebarComponent from '@/components/layout/SidebarComponent'
|
||||
import { toast } from '@/components/ui/use-toast'
|
||||
import { CATEGORIES, CATEGORY_NAMES } from '@/consts'
|
||||
import { apiDelete, apiGet, apiPatch, apiPost } from '@/lib/api'
|
||||
import { postsKeys, tagsKeys } from '@/lib/queryKeys'
|
||||
import { dateString, originalCreatedAtString } from '@/lib/utils'
|
||||
|
||||
import type { DragEndEvent } from '@dnd-kit/core'
|
||||
@@ -154,8 +152,6 @@ type Props = { post: Post; sp?: boolean }
|
||||
export default (({ post, sp }: Props) => {
|
||||
sp = Boolean (sp)
|
||||
|
||||
const qc = useQueryClient ()
|
||||
|
||||
const baseTags = useMemo<TagByCategory> (() => {
|
||||
const tagsTmp = { } as TagByCategory
|
||||
|
||||
@@ -185,8 +181,6 @@ export default (({ post, sp }: Props) => {
|
||||
|
||||
const reloadTags = async (): Promise<void> => {
|
||||
setTags (buildTagByCategory (await apiGet<Post> (`/posts/${ post.id }`)))
|
||||
qc.invalidateQueries ({ queryKey: postsKeys.root })
|
||||
qc.invalidateQueries ({ queryKey: tagsKeys.root })
|
||||
}
|
||||
|
||||
const onDragEnd = async (e: DragEndEvent) => {
|
||||
|
||||
@@ -104,10 +104,14 @@ export default (({ posts, onClick }: Props) => {
|
||||
{tagsVsbl && (
|
||||
<motion.div
|
||||
key="sptags"
|
||||
className="md:hidden overflow-hidden"
|
||||
initial={{ height: 0 }}
|
||||
animate={{ height: 'auto' }}
|
||||
exit={{ height: 0 }}
|
||||
className="md:hidden mt-4"
|
||||
variants={{ hidden: { clipPath: 'inset(0 0 100% 0)',
|
||||
height: 0 },
|
||||
visible: { clipPath: 'inset(0 0 0% 0)',
|
||||
height: 'auto'} }}
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
exit="hidden"
|
||||
transition={{ duration: .2, ease: 'easeOut' }}>
|
||||
{posts.length > 0 && TagBlock}
|
||||
</motion.div>)}
|
||||
|
||||
新しい課題から参照
ユーザをブロックする