2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-08-21 19:11:18 +08:00

secure the links on the topic pages, eliminated deleted topics as well.

This commit is contained in:
Sam 2013-06-05 16:10:26 +10:00
parent 913a607528
commit 870e59883b
9 changed files with 137 additions and 70 deletions

View file

@ -16,6 +16,15 @@ class SqlBuilder
end
end
def secure_category(secure_category_ids, category_alias = 'c')
if secure_category_ids.present?
where("NOT COALESCE(" << category_alias << ".secure, false) OR " << category_alias << ".id IN (:secure_category_ids)", secure_category_ids: secure_category_ids)
else
where("NOT COALESCE(" << category_alias << ".secure, false)")
end
self
end
def to_sql
sql = @sql.dup