|
|
@@ -98,10 +98,16 @@ const accept = async targetId => {
|
|
98
|
98
|
profileId,
|
|
99
|
99
|
targetId,
|
|
100
|
100
|
})
|
|
|
101
|
+
|
|
|
102
|
+ // Reuse old grouping name if theres a match
|
|
|
103
|
+ let channel = groupingName
|
|
101
|
104
|
console.log('membershipMatch :>> ', membershipMatch)
|
|
102
|
105
|
if (membershipMatch?.hasMatch) {
|
|
103
|
|
- await subscribeToChat(groupingName)
|
|
|
106
|
+ const [time, intiator, target] = groupingName.split('_')
|
|
|
107
|
+ channel = membershipMatch.groupings[0].grouping_name
|
|
|
108
|
+ console.log('channel :>> ', channel)
|
|
104
|
109
|
}
|
|
|
110
|
+ await subscribeToChannel(channel)
|
|
105
|
111
|
emit('reload')
|
|
106
|
112
|
}
|
|
107
|
113
|
|
|
|
@@ -109,7 +115,7 @@ const view = pid => {
|
|
109
|
115
|
router.push({ path: `/matches/${pid}` })
|
|
110
|
116
|
}
|
|
111
|
117
|
|
|
112
|
|
-const subscribeToChat = async groupingName => {
|
|
|
118
|
+const subscribeToChannel = async channelName => {
|
|
113
|
119
|
// create a chatter reference from the current profile
|
|
114
|
120
|
const chatter = currentProfile.chatter
|
|
115
|
121
|
// console.log('mock sender:', pid)
|
|
|
@@ -117,11 +123,11 @@ const subscribeToChat = async groupingName => {
|
|
117
|
123
|
/**
|
|
118
|
124
|
* publish a new message to the chatter with the channel and the message & title is optional
|
|
119
|
125
|
*/
|
|
120
|
|
- // You MUST send chatter channels as an array
|
|
121
|
|
- chatter.subscribe([groupingName])
|
|
122
|
|
- const res = await chatter.publish(groupingName, {
|
|
|
126
|
+ // You MUST send chatter channels as an array in an object
|
|
|
127
|
+ chatter.subscribe({ channels: [channelName] })
|
|
|
128
|
+ const res = await chatter.publish(channelName, {
|
|
123
|
129
|
title: 'New Message',
|
|
124
|
|
- description: `This is the checking to see if we are subscribed to the ${groupingName} channel!`,
|
|
|
130
|
+ description: `This is the checking to see if we are subscribed to the ${channelName} channel!`,
|
|
125
|
131
|
})
|
|
126
|
132
|
// PubNub response will be a timecode of when the message was published
|
|
127
|
133
|
console.log('res:', res)
|