mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
This commit is contained in:

committed by
Guo Xiang Tan

parent
4e1f25197d
commit
30990006a9
@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MiniSqlMultisiteConnection < MiniSql::Postgres::Connection
|
||||
|
||||
class CustomBuilder < MiniSql::Builder
|
||||
@ -8,9 +10,9 @@ class MiniSqlMultisiteConnection < MiniSql::Postgres::Connection
|
||||
|
||||
def secure_category(secure_category_ids, category_alias = 'c')
|
||||
if secure_category_ids.present?
|
||||
where("NOT COALESCE(" << category_alias << ".read_restricted, false) OR " << category_alias << ".id in (:secure_category_ids)", secure_category_ids: secure_category_ids)
|
||||
where("NOT COALESCE(#{category_alias}.read_restricted, false) OR #{category_alias}.id in (:secure_category_ids)", secure_category_ids: secure_category_ids)
|
||||
else
|
||||
where("NOT COALESCE(" << category_alias << ".read_restricted, false)")
|
||||
where("NOT COALESCE(#{category_alias}.read_restricted, false)")
|
||||
end
|
||||
self
|
||||
end
|
||||
|
Reference in New Issue
Block a user