Browse Source

:recycle: Cleaning up refactor a bit, needs another pass

tags/0.0.3^2
tomit4 3 years ago
parent
commit
c249505d02
2 changed files with 10 additions and 18 deletions
  1. 1
    11
      backend/lib/routes/membership/active.js
  2. 9
    7
      frontend/src/views/ChatView.vue

+ 1
- 11
backend/lib/routes/membership/active.js View File

75
                 groupings.map(grouping => grouping.grouping_id),
75
                 groupings.map(grouping => grouping.grouping_id),
76
             )
76
             )
77
 
77
 
78
-            // NOTE: Current implementation works okay, it only reveals the targetID's
79
-            // hidden info on the page currently, it does NOT reveal OUR OWN information
80
-            // to ourselves when revealed
81
-
82
             /**
78
             /**
83
              * Heavily process the result by storing just a profile_id
79
              * Heavily process the result by storing just a profile_id
84
              * and attach complete profiles
80
              * and attach complete profiles
85
              */
81
              */
86
-            // NOTE: only returns the pId for the target
87
             let pIds = groupings.reduce((ids, grouping) => {
82
             let pIds = groupings.reduce((ids, grouping) => {
88
                 grouping.profiles.forEach(p => {
83
                 grouping.profiles.forEach(p => {
89
-                    // you'd think to comment out here, but it still only returns CompleteProfile of target
90
-                    // pIds would be both currentProfile id and target id though
91
                     if (p.profile_id == profileId) return 
84
                     if (p.profile_id == profileId) return 
92
                     ids.push(p.profile_id)
85
                     ids.push(p.profile_id)
93
                     grouping.profile = p.profile_id
86
                     grouping.profile = p.profile_id
95
                 delete grouping.profiles
88
                 delete grouping.profiles
96
                 return ids
89
                 return ids
97
             }, [])
90
             }, [])
98
-            console.log('pIds :=>', pIds) // only returns single array of target id
99
             /** Assemble complete profiles to reference and pass */
91
             /** Assemble complete profiles to reference and pass */
100
             const completedProfiles = await profileService.getProfilesFor(
92
             const completedProfiles = await profileService.getProfilesFor(
101
                 pIds,
93
                 pIds,
102
                 'participant',
94
                 'participant',
103
                 false,
95
                 false,
104
             )
96
             )
105
-
106
             // NOTE: Doesn't rely on profile reveal field to get reveal tags
97
             // NOTE: Doesn't rely on profile reveal field to get reveal tags
107
             const getGroupingRevealTags = async () => {
98
             const getGroupingRevealTags = async () => {
108
                 const groupingRevealTags = []
99
                 const groupingRevealTags = []
142
 
133
 
143
             const completedProfilesWithRevealedInfo = await getRevealInfo()
134
             const completedProfilesWithRevealedInfo = await getRevealInfo()
144
 
135
 
145
-            // ISSUE: renders target ID but not currentProfileID in ChatView.vue
146
             const reformattedGroupings = groupings.map(g => {
136
             const reformattedGroupings = groupings.map(g => {
147
                 completedProfilesWithRevealedInfo.forEach(p => {
137
                 completedProfilesWithRevealedInfo.forEach(p => {
148
                     g.profile = g.profile == p.profile_id ? p : g.profile
138
                     g.profile = g.profile == p.profile_id ? p : g.profile
152
                 )
142
                 )
153
                 return g
143
                 return g
154
             })
144
             })
155
-            console.log('reformattedGroupings :=>', reformattedGroupings)
145
+
156
             try {
146
             try {
157
                 return {
147
                 return {
158
                     ok: true,
148
                     ok: true,

+ 9
- 7
frontend/src/views/ChatView.vue View File

15
                 button(@click='reveal(8)') reveal my email
15
                 button(@click='reveal(8)') reveal my email
16
                 // TODO: Remove later, only for testing
16
                 // TODO: Remove later, only for testing
17
                 button(@click='checkData()') check data
17
                 button(@click='checkData()') check data
18
-            p you revealed:
19
-                span(v-if="grouping.revealed[profile.id.value]")
20
-                    ul(v-for="reveal in grouping.revealed[profile.id.value]")
21
-                        li {{ reveal.description }}: {{ profile._profile[reveal.description] }}
22
-            p they revealed:
18
+            span(v-if="grouping.revealed[profile.id.value]")
19
+                p you revealed: 
20
+                ul(v-for="reveal in grouping.revealed[profile.id.value]")
21
+                    li {{ reveal.description }}
23
             span(v-if="grouping.revealed[target.profile_id]")
22
             span(v-if="grouping.revealed[target.profile_id]")
23
+                p they revealed:
24
                 ul(v-for="reveal in grouping.revealed[target.profile_id]")
24
                 ul(v-for="reveal in grouping.revealed[target.profile_id]")
25
                     li {{ reveal.description }}: {{ target[reveal.description] }}
25
                     li {{ reveal.description }}: {{ target[reveal.description] }}
26
-            ul(v-for="revealed in grouping.revealedFromNotification")
27
-                li(v-if="revealed[revealed.tag_description] !== profile._profile[revealed.tag_description]") {{ revealed.tag_description }}: {{ revealed[revealed.tag_description] }}
26
+            span(v-else-if="grouping.revealedFromNotification.length")
27
+                p they revealed:
28
+                ul(v-for="revealed in grouping.revealedFromNotification")
29
+                    li(v-if="revealed[revealed.tag_description] !== profile._profile[revealed.tag_description]") {{ revealed.tag_description }}: {{ revealed[revealed.tag_description] }}
28
 
30
 
29
     article
31
     article
30
         template(v-if='isLoading')
32
         template(v-if='isLoading')

Loading…
Cancel
Save