Bläddra i källkod

Continued work on appending reveal data to grouping.tags

tags/0.0.3^2
tomit4 3 år sedan
förälder
incheckning
2834086b94
2 ändrade filer med 23 tillägg och 4 borttagningar
  1. 1
    0
      backend/lib/routes/membership/reveal.js
  2. 22
    4
      frontend/src/views/ChatView.vue

+ 1
- 0
backend/lib/routes/membership/reveal.js Visa fil

@@ -67,6 +67,7 @@ module.exports = {
67 67
                         {
68 68
                             name: 'REVEALED INFO',
69 69
                             revealed_info: revealInfo,
70
+                            grouping_id: grouping_id,
70 71
                             tag: tag_id,
71 72
                             type: 'info',
72 73
                         },

+ 22
- 4
frontend/src/views/ChatView.vue Visa fil

@@ -13,16 +13,16 @@ main.view--chat
13 13
             .w-flex.row
14 14
                 button(@click='reveal(7)') reveal my name
15 15
                 button(@click='reveal(8)') reveal my email
16
+                // TODO: Remove later, only for testing
17
+                button(@click='checkData()') check data
16 18
             p you revealed:
17 19
                 span(v-if="grouping.revealed[profile.id.value]")
18 20
                     ul(v-for="reveal in grouping.revealed[profile.id.value]")
19
-                        li(v-if="reveal.description === 'user_name'") {{ reveal.description }} : {{ profile._profile.user_name }}
20
-                        li(v-if="reveal.description === 'user_email'") {{ reveal.description }} : {{ profile._profile.user_email }}
21
+                        li {{ reveal.description }} : {{ profile._profile[reveal.description] }}
21 22
             p they revealed:
22 23
                 span(v-if="grouping.revealed[grouping.profile.profile_id]")
23 24
                     ul(v-for="reveal in grouping.revealed[grouping.profile.profile_id]")
24
-                        li(v-if="reveal.description === 'user_name'") {{ reveal.description }} : {{ grouping.profile.user_name }}
25
-                        li(v-if="reveal.description === 'user_email'") {{ reveal.description }} : {{ grouping.profile.user_email }}
25
+                        li {{ reveal.description }} : {{ grouping.profile[reveal.description] }}
26 26
 
27 27
     article
28 28
         template(v-if='isLoading')
@@ -89,6 +89,24 @@ export default {
89 89
         async reveal(tagId) {
90 90
             const grouping = this.getGrouping()
91 91
             await grouping.reveal(currentProfile.id.value, tagId)
92
+
93
+            const revealedData = currentProfile.toaster.stonks['REVEALED INFO']
94
+            currentProfile.groupings.forEach((g) => {
95
+                if (g.grouping_id === revealedData.grouping_id) {
96
+                    g.tags.forEach((t) => {
97
+                        if (currentProfile.id.value === t.profile_id &&
98
+                            t.tag_id === revealedData.tag) {
99
+                            // data does not persist after refresh
100
+                            t.tag.tag_data = revealedData.revealed_info
101
+                        }
102
+                    })
103
+                }
104
+            })
105
+            /* console.log(currentProfile) */
106
+        },
107
+        // TODO: remove, only for testing reveal()
108
+        async checkData() {
109
+            console.log(currentProfile)
92 110
         },
93 111
         /**
94 112
          * Pubnub message callback fires when message event

Laddar…
Avbryt
Spara