|
|
@@ -9,17 +9,17 @@ class CompleteProfile {
|
|
9
|
9
|
constructor(profile, includeResponses = false, type) {
|
|
10
|
10
|
this.user_id = profile.user_id // int user_id
|
|
11
|
11
|
this.profile_id = profile.profile_id // int profile_id
|
|
12
|
|
- this.user_name = profile.user.user_name // string user_name
|
|
13
|
|
- this.user_email = profile.user.user_email
|
|
|
12
|
+ this.user_name = 'hidden_name'// string user_name
|
|
|
13
|
+ this.user_email = 'hidden@email.com'
|
|
14
|
14
|
this.responses = []
|
|
15
|
15
|
this.user_type = type
|
|
16
|
16
|
this.tags = profile.tags.filter(t => t.tag_category != 'reveal')
|
|
17
|
|
-
|
|
18
|
17
|
// TODO: generalize this for multiple images, and languages
|
|
19
|
18
|
this.profile_description = ''
|
|
20
|
19
|
this.profile_media = []
|
|
21
|
20
|
this.profile_languages = []
|
|
22
|
21
|
this.profile_prefs = {}
|
|
|
22
|
+ this.user_info = profile.user
|
|
23
|
23
|
|
|
24
|
24
|
// TODO: Use reveal tags to add or remove information from profile!
|
|
25
|
25
|
// TODO: ---
|
|
|
@@ -27,20 +27,6 @@ class CompleteProfile {
|
|
27
|
27
|
// TODO: and include for certain profiles
|
|
28
|
28
|
|
|
29
|
29
|
this.reveal = profile.tags.filter(t => t.tag_category == 'reveal')
|
|
30
|
|
- // Hides values until revealed
|
|
31
|
|
- const defaultValues = {
|
|
32
|
|
- user_name: 'hidden_name',
|
|
33
|
|
- user_email: 'hidden@email.com',
|
|
34
|
|
- }
|
|
35
|
|
- // BUG: If user reveals EITHER name or email, BOTH get revealed together...
|
|
36
|
|
- if (!this.reveal.length) {
|
|
37
|
|
- for (let [attribute, defaultVal] of Object.entries(defaultValues)) {
|
|
38
|
|
- const typeOfReveal = typeof this.reveal.find(tag => tag.tag_description === attribute)
|
|
39
|
|
- if (typeOfReveal == 'undefined') {
|
|
40
|
|
- this[attribute] = defaultVal
|
|
41
|
|
- }
|
|
42
|
|
- }
|
|
43
|
|
- }
|
|
44
|
30
|
// TODO: filter these correctly
|
|
45
|
31
|
if (profile?.responses?.length && includeResponses) {
|
|
46
|
32
|
// [] of all "profile" responses
|