Adds a helper method for party privacy
This commit is contained in:
parent
5d8ec96172
commit
59564df5ab
1 changed files with 16 additions and 0 deletions
|
|
@ -242,6 +242,7 @@ module Api
|
|||
|
||||
def build_filters
|
||||
params = request.params
|
||||
# == Preview Generation
|
||||
|
||||
start_time = build_start_time(params['recency'])
|
||||
|
||||
|
|
@ -474,6 +475,21 @@ module Api
|
|||
'source_party_id IS NULL'
|
||||
end
|
||||
|
||||
# == Filter Condition Helpers
|
||||
|
||||
# Generates privacy condition based on favorites
|
||||
# @param favorites [Boolean] whether viewing favorites
|
||||
# @return [String, nil] SQL condition
|
||||
def privacy(favorites: false)
|
||||
return if admin_mode
|
||||
|
||||
if favorites
|
||||
'visibility < 3'
|
||||
else
|
||||
'visibility = 1'
|
||||
end
|
||||
end
|
||||
|
||||
def id_to_table(id)
|
||||
case id[0]
|
||||
when '3'
|
||||
|
|
|
|||
Loading…
Reference in a new issue