mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 17:45:34 +08:00
Clearer syntax in migration
Following up on 1c1fd205
This commit is contained in:
parent
32f9fd1e51
commit
fb7f21fbe9
@ -18,8 +18,8 @@ class EnableContentSecurityPolicyForNewSites < ActiveRecord::Migration[5.2]
|
||||
end
|
||||
|
||||
def instance_is_new?
|
||||
post = DB.query_single("SELECT created_at FROM posts ORDER BY created_at ASC LIMIT 1")
|
||||
return post.blank? || (post.present? && post.first > 1.week.ago)
|
||||
dates = DB.query_single("SELECT created_at FROM posts ORDER BY created_at ASC LIMIT 1")
|
||||
dates.empty? || dates.first > 1.week.ago
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user