Skip to content

Commit

Permalink
Merge branch 'master' into dv_teams_support_quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
franklevasseur authored Mar 25, 2024
2 parents d175939 + 4950e68 commit 8c8aa5f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"test:e2e:pg": "cross-env POSTGRESQL=true jest -c ./test/jest.e2e.config.ts",
"test:sec:pg": "cross-env POSTGRESQL=true jest -c ./test/jest.security.config.ts",
"test:mig:pg": "cross-env POSTGRESQL=true jest -c ./test/jest.migration.config.ts",
"test:chat:chrome": "start-test 'start' http://localhost:3100/status 'ts-node packages/inject/test/serve.ts' 3700 'cypress run --browser chrome'",
"test:chat:firefox": "start-test 'start' http://localhost:3100/status 'ts-node packages/inject/test/serve.ts' 3700 'cypress run --browser firefox'",
"test:chat:chrome": "start-test 'start' 'http://localhost:3100/status' 'ts-node packages/inject/test/serve.ts' '3700' 'cypress run --browser chrome'",
"test:chat:firefox": "start-test 'start' 'http://localhost:3100/status' 'ts-node packages/inject/test/serve.ts' '3700' 'cypress run --browser firefox'",
"cypress:open": "cypress open"
},
"bin": "./packages/server/dist/index.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/inject/test/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const startServer = async () => {
const app = express()
const client = await getMessagingClient()

app.get('/', async (req, res) => {
res.sendStatus(200)
})

app.get<MessagingConfig>('/getConfig', async (req, res) => {
res.json({ client, messagingUrl })
})
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/socket/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class SocketManager {
const userData = parseUserData(socket.handshake.query.userData)

if (creds) {
const user = await this.users.fetch(creds.userId)
const user = await this.users.fetch(creds.userId, { ignoreCache: true })
if (user?.clientId === clientId && (await this.userTokens.verifyToken(user.id, creds.userToken))) {
socket.data.creds = creds
// we don't need to send it back if it was already sent to us
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/users/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export class UserService extends Service {
await this.emitter.emit(UserEvents.Updated, { user })
}

public async fetch(id: uuid): Promise<User | undefined> {
public async fetch(id: uuid, opts?: { ignoreCache?: boolean }): Promise<User | undefined> {
const cached = this.cache.get(id)
if (cached) {
if (cached && !opts?.ignoreCache) {
return cached
}

Expand Down
12 changes: 9 additions & 3 deletions test/cypress/webchat.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ describe('Webchat', () => {
cy.openWebchat()

cy.wait(400)

cy.log('#### HELLO ###')

checkLifecycleEvent(0, 'CONFIG.SET')
checkLifecycleEvent(1, 'USER.CONNECTED')
checkLifecycleEvent(2, 'LIFECYCLE.LOADED')
// we don't really care about the order of the events between
checkLifecycleEvent(1, 'LIFECYCLE.LOADED')
checkLifecycleEvent(2, 'UI.SET-CLASS')
checkLifecycleEvent(3, 'UI.OPENED')
// checkLifecycleEvent(4, 'UI.SET-CLASS')
checkLifecycleEvent(5, 'USER.CONNECTED')
// checkLifecycleEvent(6, 'USER.CONNECTED')
checkLifecycleEvent(7, 'LIFECYCLE.READY')
})

Expand Down

0 comments on commit 8c8aa5f

Please sign in to comment.