Skip to content

Commit aa62bdc

Browse files
committed
open newly created folder instead of download
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
1 parent 6bb365e commit aa62bdc

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

apps/files/src/components/FileEntryMixin.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,34 @@ import type { PropType } from 'vue'
77
import type { FileSource } from '../types.ts'
88

99
import { openConflictPicker } from '@nextcloud/dialogs'
10-
import { FileType, Folder, getFileActions, File as NcFile, Node, NodeStatus, Permission } from '@nextcloud/files'
10+
import { FileType, Folder, getFileActions, File as NcFile, Node, NodeStatus, Permission, type View } from '@nextcloud/files'
1111
import { t } from '@nextcloud/l10n'
1212
import { extname } from '@nextcloud/paths'
1313
import { isPublicShare } from '@nextcloud/sharing/public'
1414
import { generateUrl } from '@nextcloud/router'
1515
import { getConflicts, getUploader } from '@nextcloud/upload'
1616
import { vOnClickOutside } from '@vueuse/components'
1717
import { relative } from 'path'
18+
import { storeToRefs } from 'pinia'
1819
import Vue, { computed, defineComponent } from 'vue'
1920

2021
import { action as sidebarAction } from '../actions/sidebarAction.ts'
2122
import { onDropInternalFiles } from '../services/DropService.ts'
23+
import { useActiveStore } from '../store/active.ts'
2224
import { getDragAndDropPreview } from '../utils/dragUtils.ts'
2325
import { hashCode } from '../utils/hashUtils.ts'
2426
import { isDownloadable } from '../utils/permissions.ts'
2527
import logger from '../logger.ts'
2628

2729
Vue.directive('onClickOutside', vOnClickOutside)
2830

31+
type FileActionContext = {
32+
nodes: Node[]
33+
view: View
34+
folder: Folder
35+
contents: Node[]
36+
}
37+
2938
const actions = getFileActions()
3039

3140
export default defineComponent({
@@ -59,6 +68,15 @@ export default defineComponent({
5968
}
6069
},
6170

71+
setup() {
72+
const { activeFolder, activeView } = storeToRefs(useActiveStore())
73+
74+
return {
75+
activeFolder,
76+
activeView,
77+
}
78+
},
79+
6280
data() {
6381
return {
6482
dragover: false,
@@ -229,6 +247,19 @@ export default defineComponent({
229247
}
230248
},
231249

250+
fileActionView(): View {
251+
return this.activeView ?? this.currentView
252+
},
253+
254+
fileActionContext(): FileActionContext {
255+
return {
256+
nodes: [this.source],
257+
view: this.fileActionView,
258+
folder: this.activeFolder!,
259+
contents: this.nodes,
260+
}
261+
},
262+
232263
/**
233264
* Sorted actions that are enabled for this node
234265
*/
@@ -246,7 +277,7 @@ export default defineComponent({
246277
// In case something goes wrong, since we don't want to break
247278
// the entire list, we filter out actions that throw an error.
248279
try {
249-
return action.enabled([this.source], this.currentView)
280+
return (action.enabled as (context: FileActionContext) => boolean)(this.fileActionContext)
250281
} catch (error) {
251282
logger.error('Error while checking action', { action, error })
252283
return false

apps/files/src/components/FilesListVirtual.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ export default defineComponent({
803803
display: flex;
804804
align-items: center;
805805
text-align: start;
806+
cursor: pointer;
806807
// Fill cell height and width
807808
width: 100%;
808809
height: 100%;
@@ -826,8 +827,13 @@ export default defineComponent({
826827
}
827828
}
828829
830+
span.files-list__row-name-link {
831+
cursor: pointer;
832+
}
833+
829834
.files-list__row-name-text {
830835
color: var(--color-main-text);
836+
cursor: pointer;
831837
// Make some space for the outline
832838
padding: var(--default-grid-baseline) calc(2 * var(--default-grid-baseline));
833839
padding-inline-start: -10px;
@@ -998,6 +1004,7 @@ export default defineComponent({
9981004
9991005
.files-list__row-name-text {
10001006
margin: 0;
1007+
cursor: pointer;
10011008
// Ensure that the outline is not too close to the text.
10021009
margin-inline-start: -4px;
10031010
padding: 0px 4px;

0 commit comments

Comments
 (0)