Skip to content

Commit 461cc4a

Browse files
authored
Merge branch 'master' into fix/preview-cleanup-null-location
2 parents 1136d71 + 5ea6625 commit 461cc4a

12 files changed

Lines changed: 100 additions & 14 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { describe, expect, it, vi } from 'vitest'
7+
import Vue from 'vue'
8+
import Share from './Share.ts'
9+
10+
vi.mock('../services/SharingService.ts', () => ({
11+
isFileRequest: () => false,
12+
}))
13+
14+
describe('Share', () => {
15+
it('defaults sendPasswordByTalk to false when the server omits it', () => {
16+
const share = new Share({ id: 1 })
17+
expect(share.sendPasswordByTalk).toBe(false)
18+
})
19+
20+
it('keeps the server value of sendPasswordByTalk', () => {
21+
const share = new Share({ id: 1, send_password_by_talk: true })
22+
expect(share.sendPasswordByTalk).toBe(true)
23+
})
24+
25+
it('triggers reactive updates when sendPasswordByTalk is set', async () => {
26+
const share = new Share({ id: 1 })
27+
const vm = new Vue({
28+
data: { state: share.state },
29+
computed: {
30+
enabled(): boolean {
31+
return share.sendPasswordByTalk
32+
},
33+
},
34+
})
35+
expect(vm.enabled).toBe(false)
36+
37+
share.sendPasswordByTalk = true
38+
await vm.$nextTick()
39+
40+
expect(vm.enabled).toBe(true)
41+
})
42+
})

‎apps/files_sharing/src/models/Share.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export default class Share {
3939
}
4040
ocsData.attributes = ocsData.attributes ?? []
4141

42-
// Pre-declared so Vue 2 makes newPassword reactive at observation time,
42+
// Pre-declared so Vue 2 makes these reactive at observation time,
4343
// avoiding $set's property-addition path which races with async setters.
4444
ocsData.newPassword = ocsData.newPassword ?? undefined
45+
ocsData.send_password_by_talk = ocsData.send_password_by_talk ?? false
4546

4647
// store state
4748
this._share = ocsData

‎dist/7987-7987.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/7987-7987.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/8008-8008.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/8008-8008.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/files_sharing-files_sharing_tab.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/files_sharing-files_sharing_tab.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/files_sharing-init.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/files_sharing-init.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)