mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: support regex in rake post:remap (#5201)
This commit is contained in:
@@ -91,6 +91,16 @@ class Post < ActiveRecord::Base
|
||||
|
||||
q.order('posts.created_at ASC')
|
||||
}
|
||||
scope :raw_match, -> (pattern, type = 'string') {
|
||||
type = type&.downcase
|
||||
|
||||
case type
|
||||
when 'string'
|
||||
where('raw ILIKE ?', "%#{pattern}%")
|
||||
when 'regex'
|
||||
where('raw ~ ?', pattern)
|
||||
end
|
||||
}
|
||||
|
||||
delegate :username, to: :user
|
||||
|
||||
|
||||
Reference in New Issue
Block a user