Skip to content

Commit 6d006cf

Browse files
committed
chore(refactor): instantiate SessionConnection with plain data
Signed-off-by: Max <max@nextcloud.com>
1 parent fe5192c commit 6d006cf

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

cypress/support/sessions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
1212

1313
Cypress.Commands.add('createTextSession', async (fileId, options = {}) => {
1414
const { connection, data } = await open({ fileId, token: options.shareToken, ...options })
15-
return new SessionConnection({ data }, connection)
15+
return new SessionConnection(data, connection)
1616
})
1717

1818
Cypress.Commands.add('destroySession', async (sessionConnection) => {

src/services/SessionConnection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class SessionConnection {
2626
#hasOwner
2727
connection
2828

29-
constructor(response, connection) {
29+
constructor(data, connection) {
3030
const {
3131
document,
3232
session,
@@ -35,7 +35,7 @@ export class SessionConnection {
3535
content,
3636
documentState,
3737
hasOwner,
38-
} = response.data
38+
} = data
3939
this.#document = document
4040
this.#session = session
4141
this.#lock = lock

src/services/SyncService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class SyncService {
162162
return
163163
}
164164
this.sessionConnection = new SessionConnection(
165-
{ data },
165+
data,
166166
this.connection.value,
167167
)
168168
this.backend = new PollingBackend(this, this.sessionConnection)

0 commit comments

Comments
 (0)