Skip to content

Commit 46978ee

Browse files
authored
Merge pull request #65 from CS3219-AY2425S1/collab-post-ms6
prevent users from matching with themselves
2 parents fde213a + bf1bbd3 commit 46978ee

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

collab/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ func (h *Hub) Run() {
139139
}
140140
h.mutex.Unlock()
141141
}
142+
143+
144+
142145
}
143146
}
144147

@@ -161,6 +164,7 @@ func serveWs(
161164
return
162165
}
163166

167+
164168
client := &Client{conn: conn, roomID: roomID}
165169
hub.register <- client
166170

@@ -214,6 +218,8 @@ func handleMessages(
214218
log.Printf("Failed to parse message: %v", err)
215219
continue
216220
}
221+
222+
217223
if msgData["type"] == "auth" {
218224
token, tokenOk := msgData["token"].(string)
219225
if !tokenOk {

matching-service/storage/client_mappings.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ func (db *ClientMappings) HandleRequest(request models.IncomingRequests) (*model
4343
}
4444

4545
for _, user1 := range currMappings {
46+
47+
if user1 == user2 {
48+
//users cannot match with themselves
49+
continue
50+
}
51+
4652
result, err := db.Conn.HGetAll(ctx, user1).Result()
4753

4854
if err == redis.Nil {

peerprep/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
const nextConfig = {};
33

44
module.exports = {
5+
eslint: {
6+
ignoreDuringBuilds: true,
7+
},
58
reactStrictMode: false,
69
async rewrites() {
710
return [

0 commit comments

Comments
 (0)