Commit bdd8a4d05b5ed49c8cf3fab2d425f2907455c433
1 parent
56eb1e8b
Exists in
master
and in
22 other branches
stoa-api: allow custom fields since their privacy is not customizable
Showing
2 changed files
with
15 additions
and
13 deletions
Show diff stats
plugins/stoa/controllers/stoa_plugin_controller.rb
| ... | ... | @@ -42,15 +42,4 @@ class StoaPluginController < PublicController |
| 42 | 42 | end |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | - private | |
| 46 | - | |
| 47 | - def selected_fields(kind, user) | |
| 48 | - fields = FIELDS[kind] || FIELDS['essential'] | |
| 49 | - return fields.reject { |field| !FIELDS['essential'].include?(field) } unless user.person.public_profile | |
| 50 | - fields.reject do |field| | |
| 51 | - !user.person.public_fields.include?(field) && | |
| 52 | - !FIELDS['essential'].include?(field) | |
| 53 | - end | |
| 54 | - end | |
| 55 | - | |
| 56 | 45 | end | ... | ... |
plugins/stoa/lib/stoa_plugin/person_fields.rb
| 1 | 1 | module StoaPlugin::PersonFields |
| 2 | 2 | HEAVY = %w[image_base64] |
| 3 | 3 | FILTER = %w[image] |
| 4 | - EXTRA = %w[tags] | |
| 4 | + EXTRA = %w[tags communities] | |
| 5 | + CUSTOM = %w[first_name surname homepage image_base64 tags communities] | |
| 5 | 6 | |
| 6 | 7 | ESSENTIAL = %w[username email nusp] |
| 7 | - AVERAGE = ESSENTIAL + %w[name first_name surname address homepage communities] | |
| 8 | + AVERAGE = ESSENTIAL + %w[name first_name surname address homepage] | |
| 8 | 9 | FULL = (AVERAGE + Person.fields + HEAVY + EXTRA - FILTER).uniq |
| 9 | 10 | COMPLETE = FULL - HEAVY |
| 10 | 11 | |
| ... | ... | @@ -15,4 +16,16 @@ module StoaPlugin::PersonFields |
| 15 | 16 | 'full' => FULL, |
| 16 | 17 | 'complete' => COMPLETE |
| 17 | 18 | } |
| 19 | + | |
| 20 | + private | |
| 21 | + | |
| 22 | + def selected_fields(kind, user) | |
| 23 | + fields = FIELDS[kind] || FIELDS['essential'] | |
| 24 | + return fields.reject { |field| !FIELDS['essential'].include?(field) } unless user.person.public_profile | |
| 25 | + fields.reject do |field| | |
| 26 | + !user.person.public_fields.include?(field) && | |
| 27 | + !FIELDS['essential'].include?(field) && | |
| 28 | + !CUSTOM.include?(field) | |
| 29 | + end | |
| 30 | + end | |
| 18 | 31 | end | ... | ... |