Skip to content

Commit 32eff67

Browse files
committed
chore(cleanup): unused updateSession and dependencies
Signed-off-by: Max <max@nextcloud.com>
1 parent 28ba2f2 commit 32eff67

2 files changed

Lines changed: 0 additions & 65 deletions

File tree

src/services/SessionConnection.js

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import axios from '@nextcloud/axios'
6-
import { generateUrl } from '@nextcloud/router'
7-
8-
export class ConnectionClosedError extends Error {
9-
constructor(
10-
message = 'Close has already been called on the connection',
11-
...rest
12-
) {
13-
super(message, ...rest)
14-
}
15-
}
165

176
export class SessionConnection {
187
#content
@@ -67,25 +56,6 @@ export class SessionConnection {
6756
return this.#hasOwner
6857
}
6958

70-
get #defaultParams() {
71-
return {
72-
documentId: this.#document.id,
73-
sessionId: this.#session.id,
74-
sessionToken: this.#session.token,
75-
token: this.connection.shareToken,
76-
}
77-
}
78-
79-
// TODO: maybe return a new connection here so connections have immutable state
80-
update(guestName) {
81-
return this.#post(this.#url(`session/${this.#document.id}/session`), {
82-
...this.#defaultParams,
83-
guestName,
84-
}).then(({ data }) => {
85-
this.#session = data
86-
})
87-
}
88-
8959
close() {
9060
this.closed = true
9161
}
@@ -94,29 +64,4 @@ export class SessionConnection {
9464
setBaseVersionEtag(baseVersionEtag) {
9565
this.#document.baseVersionEtag = baseVersionEtag
9666
}
97-
98-
#post(...args) {
99-
if (this.closed) {
100-
return Promise.reject(new ConnectionClosedError())
101-
}
102-
return axios.post(...args)
103-
}
104-
105-
#url(endpoint) {
106-
const isPublic = !!this.#defaultParams.token
107-
return _endpointUrl(endpoint, isPublic)
108-
}
109-
}
110-
111-
/**
112-
*
113-
* @param {string} endpoint - endpoint of the url inside apps/text
114-
* @param {boolean} isPublic - public url or not
115-
*/
116-
function _endpointUrl(endpoint, isPublic = false) {
117-
const _baseUrl = generateUrl('/apps/text')
118-
if (isPublic) {
119-
return `${_baseUrl}/public/${endpoint}`
120-
}
121-
return `${_baseUrl}/${endpoint}`
12267
}

src/services/SyncService.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,6 @@ class SyncService {
192192
}
193193
}
194194

195-
updateSession(guestName: string) {
196-
if (!this.sessionConnection?.isPublic) {
197-
return Promise.reject(new Error())
198-
}
199-
return this.sessionConnection.update(guestName).catch((error) => {
200-
logger.error('Failed to update the session', { error })
201-
return Promise.reject(error)
202-
})
203-
}
204-
205195
sendStep(step: ArrayBuffer) {
206196
this.#outbox.storeStep(step)
207197
this.sendSteps()

0 commit comments

Comments
 (0)