mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Apply syntax_tree formatting to lib/*
This commit is contained in:
@ -1,16 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MiniSqlMultisiteConnection < MiniSql::ActiveRecordPostgres::Connection
|
||||
|
||||
class CustomBuilder < MiniSql::Builder
|
||||
|
||||
def initialize(connection, sql)
|
||||
super
|
||||
end
|
||||
|
||||
def secure_category(secure_category_ids, category_alias = 'c')
|
||||
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)")
|
||||
end
|
||||
@ -40,8 +41,10 @@ class MiniSqlMultisiteConnection < MiniSql::ActiveRecordPostgres::Connection
|
||||
end
|
||||
end
|
||||
|
||||
def before_committed!(*); end
|
||||
def rolledback!(*); end
|
||||
def before_committed!(*)
|
||||
end
|
||||
def rolledback!(*)
|
||||
end
|
||||
def trigger_transactional_callbacks?
|
||||
true
|
||||
end
|
||||
@ -67,9 +70,7 @@ class MiniSqlMultisiteConnection < MiniSql::ActiveRecordPostgres::Connection
|
||||
def after_commit(&blk)
|
||||
return blk.call if !transaction_open?
|
||||
|
||||
ActiveRecord::Base.connection.add_transaction_record(
|
||||
AfterCommitWrapper.new(&blk)
|
||||
)
|
||||
ActiveRecord::Base.connection.add_transaction_record(AfterCommitWrapper.new(&blk))
|
||||
end
|
||||
|
||||
def self.instance
|
||||
@ -107,5 +108,4 @@ class MiniSqlMultisiteConnection < MiniSql::ActiveRecordPostgres::Connection
|
||||
query
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user