Skip to content

Commit 52718fe

Browse files
Merge pull request #46422 from nextcloud/backport/46374/stable28
[stable28] fix: Update Nextcloud libraries
2 parents 7096ef2 + 5565ac6 commit 52718fe

File tree

169 files changed

+862
-942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+862
-942
lines changed

__tests__/jest-setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ import 'jest-location-mock'
2727

2828
// Mock `window.fetch` with Jest
2929
import 'jest-fetch-mock'
30+
31+
// Mock webroot to be empty
32+
(window as unknown as Record<string, unknown>)._oc_webroot = ''

apps/files/src/actions/moveOrCopyAction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { AxiosError } from 'axios'
3030
import { basename, join } from 'path'
3131
import { emit } from '@nextcloud/event-bus'
3232
import { FilePickerClosed, getFilePickerBuilder, showError } from '@nextcloud/dialogs'
33-
import { Permission, FileAction, FileType, NodeStatus, davGetClient, davRootPath, davResultToNode, davGetDefaultPropfind } from '@nextcloud/files'
33+
import { FileAction, FileType, NodeStatus, davGetClient, davRootPath, davResultToNode, davGetDefaultPropfind, getUniqueName } from '@nextcloud/files'
3434
import { translate as t } from '@nextcloud/l10n'
3535
import { openConflictPicker, hasConflict } from '@nextcloud/upload'
3636
import Vue from 'vue'
@@ -41,7 +41,6 @@ import FolderMoveSvg from '@mdi/svg/svg/folder-move.svg?raw'
4141
import { MoveCopyAction, canCopy, canMove, getQueue } from './moveOrCopyActionUtils'
4242
import { getContents } from '../services/Files'
4343
import logger from '../logger'
44-
import { getUniqueName } from '../utils/fileUtils'
4544

4645
/**
4746
* Return the action that is possible for the given nodes

apps/files/src/actions/openFolderAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const action = new FileAction({
2727
id: 'open-folder',
2828
displayName(files: Node[]) {
2929
// Only works on single node
30-
const displayName = files[0].attributes.displayName || files[0].basename
30+
const displayName = files[0].attributes.displayname || files[0].basename
3131
return t('files', 'Open folder {displayName}', { displayName })
3232
},
3333
iconSvgInline: () => FolderSvg,

apps/files/src/components/BreadCrumbs.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
<script lang="ts">
5454
import type { Node } from '@nextcloud/files'
55+
import type { FileSource } from '../types.ts'
5556
5657
import { basename } from 'path'
5758
import { defineComponent } from 'vue'
@@ -62,6 +63,7 @@ import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js'
6263
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js'
6364
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
6465
66+
import { useNavigation } from '../composables/useNavigation'
6567
import { onDropInternalFiles, dataTransferToFileTree, onDropExternalFiles } from '../services/DropService'
6668
import { showError } from '@nextcloud/dialogs'
6769
import { useDragAndDropStore } from '../store/dragging.ts'
@@ -71,7 +73,6 @@ import { useSelectionStore } from '../store/selection.ts'
7173
import { useUploaderStore } from '../store/uploader.ts'
7274
import filesListWidthMixin from '../mixins/filesListWidth.ts'
7375
import logger from '../logger'
74-
import type { FileSource } from '../types.ts'
7576
7677
export default defineComponent({
7778
name: 'BreadCrumbs',
@@ -99,21 +100,20 @@ export default defineComponent({
99100
const pathsStore = usePathsStore()
100101
const selectionStore = useSelectionStore()
101102
const uploaderStore = useUploaderStore()
103+
const { currentView } = useNavigation()
102104
103105
return {
104106
draggingStore,
105107
filesStore,
106108
pathsStore,
107109
selectionStore,
108110
uploaderStore,
111+
112+
currentView,
109113
}
110114
},
111115
112116
computed: {
113-
currentView() {
114-
return this.$navigation.active
115-
},
116-
117117
dirs(): string[] {
118118
const cumulativePath = (acc: string) => (value: string) => (acc += `${value}/`)
119119
// Generate a cumulative path for each path segment: ['/', '/foo', '/foo/bar', ...] etc
@@ -167,17 +167,17 @@ export default defineComponent({
167167
getNodeFromSource(source: FileSource): Node | undefined {
168168
return this.filesStore.getNode(source)
169169
},
170-
getFileSourceFromPath(path: string): FileSource | undefined {
171-
return this.pathsStore.getPath(this.currentView!.id, path)
170+
getFileSourceFromPath(path: string): FileSource | null {
171+
return (this.currentView && this.pathsStore.getPath(this.currentView.id, path)) ?? null
172172
},
173173
getDirDisplayName(path: string): string {
174174
if (path === '/') {
175175
return this.$navigation?.active?.name || t('files', 'Home')
176176
}
177177
178-
const source: FileSource | undefined = this.getFileSourceFromPath(path)
178+
const source: FileSource | null = this.getFileSourceFromPath(path)
179179
const node: Node | undefined = source ? this.getNodeFromSource(source) : undefined
180-
return node?.attributes?.displayName || basename(path)
180+
return node?.attributes?.displayname || basename(path)
181181
},
182182
183183
onClick(to) {
@@ -187,6 +187,10 @@ export default defineComponent({
187187
},
188188
189189
onDragOver(event: DragEvent, path: string) {
190+
if (!event.dataTransfer) {
191+
return
192+
}
193+
190194
// Cannot drop on the current directory
191195
if (path === this.dirs[this.dirs.length - 1]) {
192196
event.dataTransfer.dropEffect = 'none'

apps/files/src/components/DragAndDropNotice.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,18 @@
4444
</template>
4545

4646
<script lang="ts">
47-
import { defineComponent } from 'vue'
48-
import { Folder, Permission } from '@nextcloud/files'
47+
import type { Folder } from '@nextcloud/files'
48+
import { Permission } from '@nextcloud/files'
4949
import { showError } from '@nextcloud/dialogs'
5050
import { translate as t } from '@nextcloud/l10n'
5151
import { UploadStatus } from '@nextcloud/upload'
52+
import { defineComponent, type PropType } from 'vue'
5253
5354
import TrayArrowDownIcon from 'vue-material-design-icons/TrayArrowDown.vue'
5455
55-
import logger from '../logger.js'
56+
import { useNavigation } from '../composables/useNavigation'
5657
import { dataTransferToFileTree, onDropExternalFiles } from '../services/DropService'
58+
import logger from '../logger.js'
5759
5860
export default defineComponent({
5961
name: 'DragAndDropNotice',
@@ -64,22 +66,26 @@ export default defineComponent({
6466
6567
props: {
6668
currentFolder: {
67-
type: Folder,
69+
type: Object as PropType<Folder>,
6870
required: true,
6971
},
7072
},
7173
74+
setup() {
75+
const { currentView } = useNavigation()
76+
77+
return {
78+
currentView,
79+
}
80+
},
81+
7282
data() {
7383
return {
7484
dragover: false,
7585
}
7686
},
7787
7888
computed: {
79-
currentView() {
80-
return this.$navigation.active
81-
},
82-
8389
/**
8490
* Check if the current folder has create permissions
8591
*/

apps/files/src/components/DragAndDropPreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default Vue.extend({
7979
summary(): string {
8080
if (this.isSingleNode) {
8181
const node = this.nodes[0]
82-
return node.attributes?.displayName || node.basename
82+
return node.attributes?.displayname || node.basename
8383
}
8484
8585
return getSummaryFor(this.nodes)

apps/files/src/components/FileEntry.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@
103103

104104
<script lang="ts">
105105
import { defineComponent } from 'vue'
106-
import { Permission, formatFileSize } from '@nextcloud/files'
106+
import { formatFileSize } from '@nextcloud/files'
107107
import moment from '@nextcloud/moment'
108108
109+
import { useNavigation } from '../composables/useNavigation'
109110
import { useActionsMenuStore } from '../store/actionsmenu.ts'
110111
import { useDragAndDropStore } from '../store/dragging.ts'
111112
import { useFilesStore } from '../store/files.ts'
@@ -157,12 +158,16 @@ export default defineComponent({
157158
const filesStore = useFilesStore()
158159
const renamingStore = useRenamingStore()
159160
const selectionStore = useSelectionStore()
161+
const { currentView } = useNavigation()
162+
160163
return {
161164
actionsMenuStore,
162165
draggingStore,
163166
filesStore,
164167
renamingStore,
165168
selectionStore,
169+
170+
currentView,
166171
}
167172
},
168173
@@ -196,21 +201,22 @@ export default defineComponent({
196201
},
197202
198203
size() {
199-
const size = parseInt(this.source.size, 10)
200-
if (typeof size !== 'number' || isNaN(size) || size < 0) {
204+
const size = this.source.size
205+
if (!size || size < 0) {
201206
return this.t('files', 'Pending')
202207
}
203208
return formatFileSize(size, true)
204209
},
210+
205211
sizeOpacity() {
206212
const maxOpacitySize = 10 * 1024 * 1024
207213
208-
const size = parseInt(this.source.size, 10)
214+
const size = this.source.size
209215
if (!size || isNaN(size) || size < 0) {
210216
return {}
211217
}
212218
213-
const ratio = Math.round(Math.min(100, 100 * Math.pow((this.source.size / maxOpacitySize), 2)))
219+
const ratio = Math.round(Math.min(100, 100 * Math.pow((size / maxOpacitySize), 2)))
214220
return {
215221
color: `color-mix(in srgb, var(--color-main-text) ${ratio}%, var(--color-text-maxcontrast))`,
216222
}

apps/files/src/components/FileEntry/FileEntryActions.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@
9393
</template>
9494

9595
<script lang="ts">
96+
import type { PropType, ShallowRef } from 'vue'
9697
import type { FileAction, Node, View } from '@nextcloud/files'
97-
import type { PropType } from 'vue'
9898
9999
import { showError, showSuccess } from '@nextcloud/dialogs'
100100
import { DefaultType, NodeStatus, getFileActions } from '@nextcloud/files'
101101
import { translate as t } from '@nextcloud/l10n'
102-
import Vue, { defineComponent } from 'vue'
102+
import { defineComponent } from 'vue'
103103
104104
import ArrowLeftIcon from 'vue-material-design-icons/ArrowLeft.vue'
105105
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
@@ -108,6 +108,7 @@ import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.
108108
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
109109
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
110110
111+
import { useNavigation } from '../../composables/useNavigation'
111112
import CustomElementRender from '../CustomElementRender.vue'
112113
import logger from '../../logger.js'
113114
@@ -150,6 +151,15 @@ export default defineComponent({
150151
},
151152
},
152153
154+
setup() {
155+
const { currentView } = useNavigation()
156+
157+
return {
158+
// The file list is guaranteed to be only shown with active view
159+
currentView: currentView as ShallowRef<View>,
160+
}
161+
},
162+
153163
data() {
154164
return {
155165
openedSubmenu: null as FileAction | null,
@@ -161,9 +171,6 @@ export default defineComponent({
161171
// Remove any trailing slash but leave root slash
162172
return (this.$route?.query?.dir?.toString() || '/').replace(/^(.+)\/$/, '$1')
163173
},
164-
currentView(): View {
165-
return this.$navigation.active as View
166-
},
167174
isLoading() {
168175
return this.source.status === NodeStatus.LOADING
169176
},
@@ -287,7 +294,7 @@ export default defineComponent({
287294
try {
288295
// Set the loading marker
289296
this.$emit('update:loading', action.id)
290-
Vue.set(this.source, 'status', NodeStatus.LOADING)
297+
this.$set(this.source, 'status', NodeStatus.LOADING)
291298
292299
const success = await action.exec(this.source, this.currentView, this.currentDir)
293300
@@ -307,7 +314,7 @@ export default defineComponent({
307314
} finally {
308315
// Reset the loading marker
309316
this.$emit('update:loading', '')
310-
Vue.set(this.source, 'status', undefined)
317+
this.$set(this.source, 'status', undefined)
311318
312319
// If that was a submenu, we just go back after the action
313320
if (isSubmenu) {

apps/files/src/components/FileEntry/FileEntryName.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
</template>
5555

5656
<script lang="ts">
57+
import type { Node } from '@nextcloud/files'
5758
import type { PropType } from 'vue'
5859
5960
import { emit } from '@nextcloud/event-bus'
@@ -66,6 +67,7 @@ import Vue from 'vue'
6667
6768
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
6869
70+
import { useNavigation } from '../../composables/useNavigation'
6971
import { useRenamingStore } from '../../store/renaming.ts'
7072
import logger from '../../logger.js'
7173
@@ -106,8 +108,12 @@ export default Vue.extend({
106108
},
107109
108110
setup() {
111+
const { currentView } = useNavigation()
109112
const renamingStore = useRenamingStore()
113+
110114
return {
115+
currentView,
116+
111117
renamingStore,
112118
}
113119
},

apps/files/src/components/FileEntryGrid.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<script lang="ts">
7878
import { defineComponent } from 'vue'
7979
80+
import { useNavigation } from '../composables/useNavigation'
8081
import { useActionsMenuStore } from '../store/actionsmenu.ts'
8182
import { useDragAndDropStore } from '../store/dragging.ts'
8283
import { useFilesStore } from '../store/files.ts'
@@ -110,12 +111,16 @@ export default defineComponent({
110111
const filesStore = useFilesStore()
111112
const renamingStore = useRenamingStore()
112113
const selectionStore = useSelectionStore()
114+
const { currentView } = useNavigation()
115+
113116
return {
114117
actionsMenuStore,
115118
draggingStore,
116119
filesStore,
117120
renamingStore,
118121
selectionStore,
122+
123+
currentView,
119124
}
120125
},
121126

0 commit comments

Comments
 (0)