mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
fixed 搜索用户项目时过虑表情字符
This commit is contained in:
@@ -52,8 +52,10 @@ class Projects::ListMyQuery < ApplicationQuery
|
||||
elsif params[:project_type].to_s === "sync_mirror"
|
||||
projects = projects.sync_mirror
|
||||
end
|
||||
|
||||
q = projects.ransack(name_or_identifier_cont: params[:search])
|
||||
|
||||
# 表情处理
|
||||
keywords = params[:search].to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
|
||||
q = projects.ransack(name_or_identifier_cont: keywords)
|
||||
|
||||
scope = q.result.includes(:project_category, :project_language,:owner, :repository, :has_pinned_users)
|
||||
|
||||
|
||||
@@ -51,7 +51,9 @@ class Projects::ListQuery < ApplicationQuery
|
||||
# items = items.where(id: @ids).by_name_or_identifier(params[:search])
|
||||
items = items.where(id: @ids)
|
||||
else
|
||||
items = items.by_name_or_identifier(params[:search]).or(main_collection.where(user_id: Owner.like(params[:search]).pluck(:id)))
|
||||
# 表情处理
|
||||
keywords = params[:search].to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
|
||||
items = items.by_name_or_identifier(keywords).or(main_collection.where(user_id: Owner.like(keywords).pluck(:id)))
|
||||
end
|
||||
items
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user