mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: Searchable user fields do not always have an integer name (#30223)
This commit is contained in:
@ -8,7 +8,10 @@ class UserCustomField < ActiveRecord::Base
|
||||
scope :searchable,
|
||||
-> do
|
||||
joins(
|
||||
"INNER JOIN user_fields ON user_fields.id = REPLACE(user_custom_fields.name, 'user_field_', '')::INTEGER AND user_fields.searchable IS TRUE AND user_custom_fields.name like 'user_field_%'",
|
||||
"INNER JOIN user_fields ON user_fields.id = REPLACE(user_custom_fields.name, 'user_field_', '')::INTEGER",
|
||||
).where("user_fields.searchable = TRUE").where(
|
||||
"user_custom_fields.name ~ ?",
|
||||
'^user_field_\\d+$',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user