Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sending tx metadata with each query #1106

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions e2e_tests/integration/bolt.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ describe('Bolt connections', () => {
.and('contain', 'Database access not available')
.should('not.contain', 'Connection lost')
})
if (Cypress.config('serverVersion') >= 3.5) {
it('send tx metadata with queries', () => {
cy.executeCommand(':clear')
const password = Cypress.config('password')
cy.connect('neo4j', password)

cy.executeCommand(':queries')
cy.resultContains('"type": "user-action"')
})
}

if (isEnterpriseEdition()) {
it('users with no role can connect and shows up in sidebar', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/services/bolt/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function _trackedTransaction(
const txFn = buildTxFunctionByMode(session)
// Use same fn signature as session.run
runFn = (input, parameters, metadata) =>
txFn(tx => tx.run(input, parameters, metadata))
txFn(tx => tx.run(input, parameters), metadata)
} else {
// Auto-Commit transaction, only used for PERIODIC COMMIT etc.
runFn = session.run.bind(session)
Expand All @@ -80,7 +80,7 @@ function _transaction(input, parameters, session, txMetadata = undefined) {
const metadata = txMetadata ? { metadata: txMetadata } : undefined
const txFn = buildTxFunctionByMode(session)

return txFn(tx => tx.run(input, parameters, metadata))
return txFn(tx => tx.run(input, parameters), metadata)
.then(r => {
session.close()
return r
Expand Down