Преглед изворни кода

:sparkles: Started on notif/persist of reveal funcs

tags/0.0.3^2
tomit4 пре 3 година
родитељ
комит
12864fb761

+ 12
- 0
backend/lib/routes/membership/reveal.js Прегледај датотеку

@@ -50,11 +50,23 @@ module.exports = {
50 50
                 const idsInGroup = memberships.map(
51 51
                     membership => membership.profile_id,
52 52
                 )
53
+
54
+                // Grab User Info from Users Table and prepare revealed info for
55
+                // notification based off of tag_id
56
+                const completeProfile = await profileService.getProfilesFor([profile_id], 'participant')
57
+                let revealInfo
58
+                if (tag_id == 7) {
59
+                    revealInfo = completeProfile[0].user_name
60
+                } else if (tag_id == 8) {
61
+                    revealInfo = completeProfile[0].user_email
62
+                }
63
+
53 64
                 idsInGroup.forEach(profile_id => {
54 65
                     request.server.methods.notify(
55 66
                         `${profile_id}.stonk`,
56 67
                         {
57 68
                             name: 'REVEALED INFO',
69
+                            revealed_info: revealInfo,
58 70
                             tag: tag_id,
59 71
                             type: 'info',
60 72
                         },

+ 1
- 1
frontend/src/components/SideBar.vue Прегледај датотеку

@@ -5,7 +5,7 @@ aside.sidebar.w-flex.column.pa8
5 5
     nav.temp-control-box
6 6
         input(v-model="switchToPID" @keyup.enter="$emit('updatePid', switchToPID)")
7 7
         button(@click="$emit('updatePid', switchToPID)") switch profile
8
-    
8
+
9 9
 </template>
10 10
 
11 11
 <script>

+ 5
- 1
frontend/src/services/notification.service.js Прегледај датотеку

@@ -34,7 +34,11 @@ class StonkAlert extends Toaster {
34 34
         })
35 35
     }
36 36
     _formatToast(parsed) {
37
-        return `${parsed.name}: ${parsed.profile_id} ${parsed.order} at ${parsed.price}`
37
+        if (parsed.revealed_info) {
38
+            return `${parsed.name}: ${parsed.revealed_info} at ${parsed.type}`
39
+        } else {
40
+            return `${parsed.name}: ${parsed.profile_id} ${parsed.order} at ${parsed.price}`
41
+        }
38 42
     }
39 43
 }
40 44
 

+ 9
- 3
frontend/src/views/ChatView.vue Прегледај датотеку

@@ -13,10 +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
-            p you revealed: 
17
-                span(v-if="grouping.revealed[profile.id]") {{ grouping.revealed }}
16
+            p you revealed:
17
+                span(v-if="grouping.revealed[profile.id.value]")
18
+                    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 }}
18 21
             p they revealed:
19
-                span(v-if="grouping.revealed[grouping.profile.profile_id]") {{ grouping.revealed[grouping.profile.profile_id] }}
22
+                span(v-if="grouping.revealed[grouping.profile.profile_id]")
23
+                    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 }}
20 26
 
21 27
     article
22 28
         template(v-if='isLoading')

Loading…
Откажи
Сачувај