Skip to content

Commit 881eb9b

Browse files
committed
chore(cleanup): sync and save service are always defined now
Signed-off-by: Max <max@nextcloud.com>
1 parent a929aa1 commit 881eb9b

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

cypress/support/sessions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import { open } from '../../src/apis/Connect.ts'
1010
const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
1111

1212
Cypress.Commands.add('createTextSession', async (fileId, options = {}) => {
13-
const { data } = await open({ fileId, ...options })
13+
const { data } = await open({ fileId, token: options.shareToken, ...options })
1414
return new Connection({ data }, options)
1515
})
1616

1717
Cypress.Commands.add('failToCreateTextSession', (fileId, baseVersionEtag = null, options = {}) => {
18-
open({ fileId, ...options, baseVersionEtag })
18+
return open({ fileId, ...options, baseVersionEtag })
1919
.then((_response) => {
2020
throw new Error('Expected request to fail - but it succeeded!')
2121
}, (err) => err.response)

src/components/CollisionResolveDialog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ export default {
6565
methods: {
6666
resolveThisVersion() {
6767
this.clicked = true
68-
this.saveService?.forceSave().then(() => this.syncService?.syncUp())
68+
this.saveService.forceSave().then(() => this.syncService.syncUp())
6969
this.setEditable(!this.readOnly)
7070
},
7171
resolveServerVersion() {
7272
const { outsideChange } = this.syncError.data
7373
this.clicked = true
7474
this.setEditable(!this.readOnly)
7575
this.setContent(outsideChange)
76-
this.saveService?.forceSave().then(() => this.syncService?.syncUp())
76+
this.saveService.forceSave().then(() => this.syncService.syncUp())
7777
},
7878
},
7979
}

src/components/Editor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ export default defineComponent({
821821
pendingStructs: this.ydoc.store.pendingStructs,
822822
pendingStructsRemote: this.syncProvider?.remote.store.pendingStructs,
823823
clientVectors: [],
824-
documentState: this.saveService?.getDocumentState(),
824+
documentState: this.saveService.getDocumentState(),
825825
}
826826
for (const client of this.ydoc.store.clients.values()) {
827827
yjsData.clientVectors.push(client.at(-1).id)
@@ -885,7 +885,7 @@ export default defineComponent({
885885
},
886886
887887
saveBeforeUnload() {
888-
this.saveService?.saveViaSendBeacon()
888+
this.saveService.saveViaSendBeacon()
889889
},
890890
},
891891
})

src/components/Editor/GuestNameDialog.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ export default {
5656
},
5757
},
5858
beforeMount() {
59-
this.guestName = this.syncService?.guestName
59+
this.guestName = this.syncService.guestName
6060
this.updateBufferedGuestName()
6161
},
6262
methods: {
6363
setGuestName() {
64-
const previousGuestName = this.syncService?.guestName
65-
this.syncService?.updateSession(this.guestName).then(() => {
64+
const previousGuestName = this.syncService.guestName
65+
this.syncService.updateSession(this.guestName).then(() => {
6666
localStorage.setItem('nick', this.guestName)
6767
this.updateBufferedGuestName()
6868
}).catch((e) => {

src/components/Editor/MediaHandler.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default {
134134
async uploadAttachmentFile(file, position = null) {
135135
this.state.isUploadingAttachments = true
136136
137-
return this.syncService?.uploadAttachment(file)
137+
return this.syncService.uploadAttachment(file)
138138
.then((response) => {
139139
this.insertAttachment(
140140
response.data?.name, response.data?.id, file.type,
@@ -168,7 +168,7 @@ export default {
168168
169169
this.state.isUploadingAttachments = true
170170
171-
return this.syncService?.insertAttachmentFile(filePath).then((response) => {
171+
return this.syncService.insertAttachmentFile(filePath).then((response) => {
172172
this.insertAttachment(
173173
response.data?.name, response.data?.id, response.data?.mimetype,
174174
null, response.data?.dirname,
@@ -182,7 +182,7 @@ export default {
182182
},
183183
createAttachment(template) {
184184
this.state.isUploadingAttachments = true
185-
return this.syncService?.createAttachment(template).then((response) => {
185+
return this.syncService.createAttachment(template).then((response) => {
186186
this.insertAttachmentPreview(response.data?.id)
187187
}).catch((error) => {
188188
logger.error('Failed to create attachment', { error })

src/components/Editor/Status.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default {
130130
methods: {
131131
onClickSave() {
132132
if (this.dirtyStateIndicator) {
133-
this.saveService?.forceSave()
133+
this.saveService.forceSave()
134134
}
135135
},
136136
onEditorWidthChange(newWidth) {

src/components/Menu/ActionAttachmentUpload.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default {
111111
return loadState('files', 'templates', [])
112112
},
113113
isUploadDisabled() {
114-
return !this.syncService?.hasOwner
114+
return !this.syncService.hasOwner
115115
},
116116
menuTitle() {
117117
return this.isUploadDisabled

src/components/SuggestionsBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default {
102102
return this.$file?.relativePath ?? '/'
103103
},
104104
isUploadDisabled() {
105-
return !this.syncService?.hasOwner
105+
return !this.syncService.hasOwner
106106
},
107107
uploadTitle() {
108108
return (

0 commit comments

Comments
 (0)