mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
team folder browsing with static team folder details
This commit is contained in:
@@ -10,6 +10,6 @@ return [
|
||||
'chunk_size' => env('CHUNK_SIZE', '128'),
|
||||
|
||||
'colors' => [
|
||||
'#9ad2bf', '#9ad2cd', '#d29a9a', '#d2ce9a', '#9aadd2', '#c59ad2'
|
||||
]
|
||||
'#9ad2bf', '#9ad2cd', '#d29a9a', '#d2ce9a', '#9aadd2', '#c59ad2',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~3e4fdd8b.js": "/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~3e4fdd8b.js?id=0017a8e827fd7058a08c",
|
||||
"/chunks/admin~chunks/app-language~chunks/dashboard~chunks/files~chunks/invoices~chunks/my-shared-item~6fce3876.js": "/chunks/admin~chunks/app-language~chunks/dashboard~chunks/files~chunks/invoices~chunks/my-shared-item~6fce3876.js?id=3dc49e837aec52b13e76",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~26d67489.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~26d67489.js?id=a76bb79a48dc94c9c4b7",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.js?id=87cd1e20835b211e4afe",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.js?id=f409162be0eaf9d30d51",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared~f312a84e.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared~f312a84e.js?id=004c11df35e63517608d",
|
||||
"/chunks/admin~chunks/platform.js": "/chunks/admin~chunks/platform.js?id=0e511f0ceaac7257bf25",
|
||||
"/chunks/admin~chunks/platform~chunks/settings.js": "/chunks/admin~chunks/platform~chunks/settings.js?id=346cac257119a5ef00ef",
|
||||
@@ -59,7 +59,7 @@
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=0dd0a5efe0e3cb511c48",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=e93cd9c42177eadc8825",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=7ec7f91183a9e46e3f41",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=c6d55fbaeae45421f8c2",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=6000d49dae81f57df3d0",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=658aa03af778cc2cc100",
|
||||
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=ddb7be518c092ed392ca",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=e8597a21a38c153e3c88",
|
||||
@@ -83,7 +83,7 @@
|
||||
"/chunks/stripe-credentials.js": "/chunks/stripe-credentials.js?id=1be90d8d2e093bf0f28b",
|
||||
"/chunks/subscription-plans.js": "/chunks/subscription-plans.js?id=1ca763d2fca8a949cec8",
|
||||
"/chunks/subscription-service.js": "/chunks/subscription-service.js?id=e6411871b271e4ecbe03",
|
||||
"/chunks/team-folders.js": "/chunks/team-folders.js?id=2bb147d346bb1b8b9eba",
|
||||
"/chunks/team-folders.js": "/chunks/team-folders.js?id=d65cc54f7b872f260f24",
|
||||
"/chunks/trash.js": "/chunks/trash.js?id=b098bf0e2f2df3e67539",
|
||||
"/chunks/upgrade-billing.js": "/chunks/upgrade-billing.js?id=8879f5c458f08648405a",
|
||||
"/chunks/upgrade-billing~chunks/upgrade-plan.js": "/chunks/upgrade-billing~chunks/upgrade-plan.js?id=e365ae16373be9dbd458",
|
||||
@@ -100,5 +100,41 @@
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~25aaad73.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~25aaad73.js?id=0de519ac9b2c2754e0c2",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~81c8aec0.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~81c8aec0.js?id=ca3b57f70682c1c315f7",
|
||||
"/vendors~chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunk~3c02639c.js": "/vendors~chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunk~3c02639c.js?id=e31953d811b86273037b",
|
||||
"/vendors~chunks/admin~chunks/platform~chunks/settings~chunks/shared.js": "/vendors~chunks/admin~chunks/platform~chunks/settings~chunks/shared.js?id=90d4a5c68188a1bbce59"
|
||||
"/vendors~chunks/admin~chunks/platform~chunks/settings~chunks/shared.js": "/vendors~chunks/admin~chunks/platform~chunks/settings~chunks/shared.js?id=90d4a5c68188a1bbce59",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.0818cc29c25f5f240268.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.0818cc29c25f5f240268.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.91ad9e0a10e2894f0126.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.91ad9e0a10e2894f0126.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.c0808c26031abef99fd9.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.c0808c26031abef99fd9.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f48bc62b4a85bede9f94.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f48bc62b4a85bede9f94.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.a422b86f72b7f92b765a.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.a422b86f72b7f92b765a.hot-update.js",
|
||||
"/js/main.837402788cdee8d4a10c.hot-update.js": "/js/main.837402788cdee8d4a10c.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f5cb1393ef7ae678b240.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f5cb1393ef7ae678b240.hot-update.js",
|
||||
"/js/main.5900077b64cbc13fa6c3.hot-update.js": "/js/main.5900077b64cbc13fa6c3.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.cb34f48ec7eebf88bd2c.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.cb34f48ec7eebf88bd2c.hot-update.js",
|
||||
"/js/main.e2b032e1dd929d894d6b.hot-update.js": "/js/main.e2b032e1dd929d894d6b.hot-update.js",
|
||||
"/chunks/team-folders.9b5c7ec2b56681d04b80.hot-update.js": "/chunks/team-folders.9b5c7ec2b56681d04b80.hot-update.js",
|
||||
"/chunks/team-folders.6ed12125fb188ff0e4f7.hot-update.js": "/chunks/team-folders.6ed12125fb188ff0e4f7.hot-update.js",
|
||||
"/chunks/team-folders.981e26a54a1a429abb65.hot-update.js": "/chunks/team-folders.981e26a54a1a429abb65.hot-update.js",
|
||||
"/js/main.c0a000a4fd50bfd81531.hot-update.js": "/js/main.c0a000a4fd50bfd81531.hot-update.js",
|
||||
"/js/main.52e334c3af340dcba411.hot-update.js": "/js/main.52e334c3af340dcba411.hot-update.js",
|
||||
"/js/main.517a156f5d8b35949d24.hot-update.js": "/js/main.517a156f5d8b35949d24.hot-update.js",
|
||||
"/js/main.fc2a78bcdc6351ea0150.hot-update.js": "/js/main.fc2a78bcdc6351ea0150.hot-update.js",
|
||||
"/js/main.24f35f1b5d886dece9e0.hot-update.js": "/js/main.24f35f1b5d886dece9e0.hot-update.js",
|
||||
"/js/main.7939adb468b346eb4b8b.hot-update.js": "/js/main.7939adb468b346eb4b8b.hot-update.js",
|
||||
"/js/main.bac529c7fb88541be8f9.hot-update.js": "/js/main.bac529c7fb88541be8f9.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.ccb8eddb695edf2fdaa4.hot-update.js": "/chunks/platform~chunks/shared.ccb8eddb695edf2fdaa4.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.c771c789cd06949a6bae.hot-update.js": "/chunks/platform~chunks/shared.c771c789cd06949a6bae.hot-update.js",
|
||||
"/js/main.dcbb83cfdea23411178c.hot-update.js": "/js/main.dcbb83cfdea23411178c.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.f4d7ed56a4e959bfbb99.hot-update.js": "/chunks/platform~chunks/shared.f4d7ed56a4e959bfbb99.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.1d3338176e8ae0405579.hot-update.js": "/chunks/platform~chunks/shared.1d3338176e8ae0405579.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.8ae100bba419fd79aee9.hot-update.js": "/chunks/platform~chunks/shared.8ae100bba419fd79aee9.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.a4e66d62a2efa13ab52b.hot-update.js": "/chunks/platform~chunks/shared.a4e66d62a2efa13ab52b.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.3110c2a312eabdb18116.hot-update.js": "/chunks/platform~chunks/shared.3110c2a312eabdb18116.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.93f5dff162e79ca46fd2.hot-update.js": "/chunks/platform~chunks/shared.93f5dff162e79ca46fd2.hot-update.js",
|
||||
"/chunks/team-folders.961ec4f67b5db08258a9.hot-update.js": "/chunks/team-folders.961ec4f67b5db08258a9.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.87fb3d6a2092b1aca5f8.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.87fb3d6a2092b1aca5f8.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.7e54e4fe2704e29af89d.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.7e54e4fe2704e29af89d.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.69b50aa8397c39fb3a7b.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.69b50aa8397c39fb3a7b.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.855b1071699829b8ef36.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.855b1071699829b8ef36.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.cbd5b81577bd1e5f68df.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.cbd5b81577bd1e5f68df.hot-update.js",
|
||||
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f8708232f16a94aada33.hot-update.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/settin~d04310d2.f8708232f16a94aada33.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
<PopoverItem name="team-folder" side="left">
|
||||
<TeamFolderPreview />
|
||||
<OptionGroup>
|
||||
<Option @click.native="$updateTeamFolder(clipboard[0])" :title="$t('Edit Members')" icon="rename" />
|
||||
<Option @click.native="$dissolveTeamFolder(clipboard[0])" :title="$t('Dissolve Team')" icon="trash" />
|
||||
<Option @click.native="$updateTeamFolder(teamFolder)" :title="$t('Edit Members')" icon="rename" />
|
||||
<Option @click.native="$dissolveTeamFolder(teamFolder)" :title="$t('Dissolve Team')" icon="trash" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
@@ -118,14 +118,22 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'currentTeamFolder',
|
||||
'isVisibleSidebar',
|
||||
'FilePreviewType',
|
||||
'currentFolder',
|
||||
'sharedDetail',
|
||||
'clipboard',
|
||||
]),
|
||||
teamFolder() {
|
||||
return this.currentTeamFolder ? this.currentTeamFolder : this.clipboard[0]
|
||||
},
|
||||
isLoadedFolder() {
|
||||
return this.sharedDetail && this.sharedDetail.data.attributes.item_id === this.$route.params.id
|
||||
if (this.$isThisRoute(this.$route, ['Public'])) {
|
||||
return this.sharedDetail && this.sharedDetail.data.attributes.item_id === this.$route.params.id
|
||||
}
|
||||
|
||||
return this.$route.params.id
|
||||
},
|
||||
hasCapacity() {
|
||||
// Check if storage limitation is set
|
||||
@@ -216,7 +224,8 @@
|
||||
if (this.isLoadedFolder) this.$router.back()
|
||||
},
|
||||
showTeamFolderMenu() {
|
||||
events.$emit('popover:open', 'team-folder')
|
||||
if (this.currentTeamFolder || this.clipboard[0])
|
||||
events.$emit('popover:open', 'team-folder')
|
||||
},
|
||||
showCreateMenu() {
|
||||
events.$emit('popover:open', 'desktop-create')
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
<!--Thumbnail for item-->
|
||||
<div class="icon-item">
|
||||
<!--If is file or image, then link item-->
|
||||
<span v-if="isFile || (isImage && !item.data.attributes.thumbnail)" class="file-icon-text text-theme dark-text-theme">
|
||||
<span v-if="isFile || isVideo || (isImage && !item.data.attributes.thumbnail)" class="file-icon-text text-theme dark-text-theme">
|
||||
{{ item.data.attributes.mimetype | limitCharacters }}
|
||||
</span>
|
||||
|
||||
<!--Folder thumbnail-->
|
||||
<FontAwesomeIcon v-if="isFile || (isImage && !item.data.attributes.thumbnail)" class="file-icon" icon="file" />
|
||||
<FontAwesomeIcon v-if="isFile || isVideo || (isImage && !item.data.attributes.thumbnail)" class="file-icon" icon="file" />
|
||||
|
||||
<!--Image thumbnail-->
|
||||
<img loading="lazy" v-if="isImage && item.data.attributes.thumbnail" class="image" :src="item.data.attributes.thumbnail" :alt="item.data.attributes.name" />
|
||||
@@ -42,11 +42,6 @@
|
||||
<link-icon size="12" class="shared-icon text-theme dark-text-theme"/>
|
||||
</div>
|
||||
|
||||
<!--Participant owner Icon-->
|
||||
<!-- <div v-if="$checkPermission('master') && item.author !== 'user'" class="item-shared">
|
||||
<user-plus-icon size="12" class="shared-icon text-theme dark-text-theme"/>
|
||||
</div>-->
|
||||
|
||||
<!--Filesize and timestamp-->
|
||||
<span v-if="!isFolder" class="item-size">{{ item.data.attributes.filesize }}, {{ timeStamp }}</span>
|
||||
|
||||
@@ -220,17 +215,7 @@ export default {
|
||||
if (!this.mobileMultiSelect && this.$isMobile()) {
|
||||
|
||||
if (this.isFolder) {
|
||||
let route = this.$router.currentRoute.name
|
||||
|
||||
if (route === 'Public') {
|
||||
this.$router.push({name: 'Public', params: {token: this.$route.params.token, id: this.item.data.id}})
|
||||
} else if (route === 'Trash') {
|
||||
this.$router.push({name: 'Trash', params: {id: this.item.data.id}})
|
||||
} else if (['Files', 'MySharedItems'].includes(route)) {
|
||||
this.$router.push({name: 'Files', params: {id: this.item.data.id}})
|
||||
} else if (route === 'TeamFolders') {
|
||||
this.$router.push({name: 'TeamFolders', params: {id: this.item.data.id}})
|
||||
}
|
||||
this.$goToFileView(this.item.data.id)
|
||||
} else {
|
||||
|
||||
if (this.isImage || this.isVideo || this.isAudio || this.isPdf) {
|
||||
@@ -263,17 +248,7 @@ export default {
|
||||
// Clear selected items after open another folder
|
||||
this.$store.commit('CLIPBOARD_CLEAR')
|
||||
|
||||
let route = this.$router.currentRoute.name
|
||||
|
||||
if (route === 'Public') {
|
||||
this.$router.push({name: 'Public', params: {token: this.$route.params.token, id: this.item.data.id}})
|
||||
} else if (route === 'Trash') {
|
||||
this.$router.push({name: 'Trash', params: {id: this.item.data.id}})
|
||||
} else if (['Files', 'MySharedItems'].includes(route)) {
|
||||
this.$router.push({name: 'Files', params: {id: this.item.data.id}})
|
||||
} else if (route === 'TeamFolders') {
|
||||
this.$router.push({name: 'TeamFolders', params: {id: this.item.data.id}})
|
||||
}
|
||||
this.$goToFileView(this.item.data.id)
|
||||
}
|
||||
},
|
||||
renameItem: debounce(function (e) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="info">
|
||||
<b class="title">The Team Project</b>
|
||||
<span class="subtitle">Last update a week ago</span>
|
||||
<TeamMembersPreview :folder="clipboard[0]" :avatar-size="32" class="members" />
|
||||
<TeamMembersPreview :folder="teamFolder" :avatar-size="32" class="members" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -19,8 +19,12 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'clipboard'
|
||||
])
|
||||
'currentTeamFolder',
|
||||
'clipboard',
|
||||
]),
|
||||
teamFolder() {
|
||||
return this.currentTeamFolder ? this.currentTeamFolder : this.clipboard[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="team-folder-wrapper">
|
||||
<div v-if="! clipboard[0]" class="empty-state">
|
||||
<div v-if="! teamFolder" class="empty-state">
|
||||
<span>Not selected</span>
|
||||
</div>
|
||||
<TeamMembersPreview v-else :folder="clipboard[0]" :limit="true" :avatar-size="32" class="widget" />
|
||||
<TeamMembersPreview v-else :folder="teamFolder" :limit="true" :avatar-size="32" class="widget" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'clipboard'
|
||||
])
|
||||
'currentTeamFolder',
|
||||
'clipboard',
|
||||
]),
|
||||
teamFolder() {
|
||||
return this.currentTeamFolder ? this.currentTeamFolder : this.clipboard[0]
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
19
resources/js/helpers/functionHelpers.js
vendored
19
resources/js/helpers/functionHelpers.js
vendored
@@ -81,12 +81,6 @@ const FunctionHelpers = {
|
||||
return '/invoice/' + customer + '/' + id
|
||||
}
|
||||
|
||||
Vue.prototype.$openImageOnNewTab = function (source) {
|
||||
let win = window.open(source, '_blank')
|
||||
|
||||
win.focus()
|
||||
}
|
||||
|
||||
Vue.prototype.$uploadFiles = async function (files) {
|
||||
|
||||
if (files.length === 0) return
|
||||
@@ -207,6 +201,19 @@ const FunctionHelpers = {
|
||||
anchor.click()
|
||||
}
|
||||
|
||||
Vue.prototype.$goToFileView = function (id) {
|
||||
|
||||
let locations = {
|
||||
'Public': {name: 'Public', params: {token: this.$route.params.token, id: id}},
|
||||
'TeamFolders': {name: 'TeamFolders', params: {id: id}},
|
||||
'MySharedItems': {name: 'Files', params: {id: id}},
|
||||
'Trash': {name: 'Trash', params: {id: id}},
|
||||
'Files': {name: 'Files', params: {id: id}},
|
||||
}
|
||||
|
||||
this.$router.push(locations[this.$router.currentRoute.name])
|
||||
}
|
||||
|
||||
Vue.prototype.$isThisRoute = function (route, locations) {
|
||||
|
||||
return locations.includes(route.name)
|
||||
|
||||
2
resources/js/store/index.js
vendored
2
resources/js/store/index.js
vendored
@@ -5,6 +5,7 @@ import fileFunctions from './modules/fileFunctions'
|
||||
import fileBrowser from './modules/fileBrowser'
|
||||
import userAuth from './modules/userAuth'
|
||||
import sharing from './modules/sharing'
|
||||
import teams from './modules/teams'
|
||||
import app from './modules/app'
|
||||
|
||||
Vue.use(Vuex)
|
||||
@@ -15,6 +16,7 @@ export default new Vuex.Store({
|
||||
fileBrowser,
|
||||
userAuth,
|
||||
sharing,
|
||||
teams,
|
||||
app,
|
||||
}
|
||||
})
|
||||
29
resources/js/store/modules/fileBrowser.js
vendored
29
resources/js/store/modules/fileBrowser.js
vendored
@@ -46,35 +46,6 @@ const actions = {
|
||||
}
|
||||
})
|
||||
},
|
||||
getTeamFolder: ({commit, getters}, id) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
|
||||
axios
|
||||
.get(`${getters.api}/teams/folders/${id}/${getters.sorting.URI}`)
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data.folders.data})
|
||||
commit('SET_CURRENT_FOLDER', response.data.root)
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
// Redirect if unauthenticated
|
||||
if ([401, 403].includes(error.response.status)) {
|
||||
|
||||
commit('SET_AUTHORIZED', false)
|
||||
router.push({name: 'SignIn'})
|
||||
|
||||
} else {
|
||||
|
||||
// Show error message
|
||||
events.$emit('alert:open', {
|
||||
title: i18n.t('popup_error.title'),
|
||||
message: i18n.t('popup_error.message'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getRecentUploads: ({commit, getters}) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
|
||||
|
||||
68
resources/js/store/modules/teams.js
vendored
Normal file
68
resources/js/store/modules/teams.js
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import router from "../../router";
|
||||
import {events} from "../../bus";
|
||||
import i18n from "../../i18n";
|
||||
import axios from "axios";
|
||||
|
||||
const defaultState = {
|
||||
currentTeamFolder: undefined,
|
||||
}
|
||||
|
||||
const actions = {
|
||||
getTeamFolder: ({commit, getters}, id) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
|
||||
if (typeof id === 'undefined') {
|
||||
commit('SET_CURRENT_TEAM_FOLDER', null)
|
||||
}
|
||||
|
||||
axios
|
||||
.get(`${getters.api}/teams/folders/${id}/${getters.sorting.URI}`)
|
||||
.then(response => {
|
||||
let folders = response.data.folders.data
|
||||
let files = response.data.files.data
|
||||
|
||||
commit('LOADING_STATE', {loading: false, data: folders.concat(files)})
|
||||
commit('SET_CURRENT_FOLDER', response.data.root)
|
||||
|
||||
if (! getters.currentTeamFolder || getters.currentTeamFolder.data.id !== response.data.teamFolder.data.id) {
|
||||
commit('SET_CURRENT_TEAM_FOLDER', response.data.teamFolder)
|
||||
}
|
||||
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
// Redirect if unauthenticated
|
||||
if ([401, 403].includes(error.response.status)) {
|
||||
|
||||
commit('SET_AUTHORIZED', false)
|
||||
router.push({name: 'SignIn'})
|
||||
|
||||
} else {
|
||||
|
||||
// Show error message
|
||||
events.$emit('alert:open', {
|
||||
title: i18n.t('popup_error.title'),
|
||||
message: i18n.t('popup_error.message'),
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_CURRENT_TEAM_FOLDER(state, payload) {
|
||||
state.currentTeamFolder = payload
|
||||
}
|
||||
}
|
||||
|
||||
const getters = {
|
||||
currentTeamFolder: state => state.currentTeamFolder,
|
||||
}
|
||||
|
||||
export default {
|
||||
state: defaultState,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -210,6 +210,7 @@
|
||||
|
||||
events.$on('context-menu:show', (event, item) => this.item = item)
|
||||
events.$on('mobile-context-menu:show', item => this.item = item)
|
||||
events.$on('context-menu:current-folder', folder => this.item = folder)
|
||||
|
||||
events.$on('action:confirmed', data => {
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use Domain\Teams\Models\TeamFolderInvitation;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Console\Command;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Domain\Settings\Models\Setting;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Domain\Teams\Models\TeamFolderInvitation;
|
||||
use Domain\Pages\Actions\SeedDefaultPagesAction;
|
||||
use Domain\Settings\Actions\SeedDefaultSettingsAction;
|
||||
use Domain\Localization\Actions\SeedDefaultLanguageAction;
|
||||
@@ -38,8 +37,7 @@ class SetupDevEnvironment extends Command
|
||||
private SeedDefaultSettingsAction $seedDefaultSettings,
|
||||
private SeedDefaultLanguageAction $seedDefaultLanguage,
|
||||
private SeedDefaultPagesAction $seedDefaultPages,
|
||||
)
|
||||
{
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->setUpFaker();
|
||||
}
|
||||
@@ -743,34 +741,36 @@ class SetupDevEnvironment extends Command
|
||||
->get();
|
||||
|
||||
collect([$members[0]->id, $members[1]->id])
|
||||
->each(fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
collect([$members[2]->id, $members[3]->id])
|
||||
->each(fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $financeDocumentsFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $financeDocumentsFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
// Create invitations
|
||||
collect([$members[4], $members[5]])
|
||||
->each(fn($user) => TeamFolderInvitation::factory()
|
||||
->create([
|
||||
'email' => $user->email,
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'status' => 'pending',
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($user) => TeamFolderInvitation::factory()
|
||||
->create([
|
||||
'email' => $user->email,
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'status' => 'pending',
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private function create_share_records(): void
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Models;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
@@ -96,7 +95,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
{
|
||||
$is_storage_limit = get_settings('storage_limitation') ?? 1;
|
||||
|
||||
if (!$is_storage_limit) {
|
||||
if (! $is_storage_limit) {
|
||||
return [
|
||||
'used' => $this->usedCapacity,
|
||||
'used_formatted' => Metric::bytes($this->usedCapacity)->format(),
|
||||
@@ -104,7 +103,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
}
|
||||
|
||||
return [
|
||||
'used' => (float)get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity),
|
||||
'used' => (float) get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity),
|
||||
'used_formatted' => get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity) . '%',
|
||||
'capacity' => $this->settings->storage_capacity,
|
||||
'capacity_formatted' => format_gigabytes($this->settings->storage_capacity),
|
||||
@@ -117,7 +116,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
public function getUsedCapacityAttribute(): int
|
||||
{
|
||||
return $this->filesWithTrashed
|
||||
->map(fn($item) => $item->getRawOriginal())->sum('filesize');
|
||||
->map(fn ($item) => $item->getRawOriginal())->sum('filesize');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace App\Users\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserSettings extends Model
|
||||
{
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use DB;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Str;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
|
||||
class BrowseFolderController
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
|
||||
class BrowseLatestFilesController
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
|
||||
class BrowseSharedItemsController
|
||||
{
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
|
||||
class BrowseTrashContentController
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Items\Requests\SearchRequest;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
|
||||
class SearchFilesAndFoldersController
|
||||
{
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
use Domain\Sharing\Actions\VerifyAccessToItemAction;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
/**
|
||||
* Browse shared folder
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
namespace Domain\Browsing\Controllers;
|
||||
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
namespace Domain\Files\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Requests\UploadRequest;
|
||||
use Domain\Files\Actions\UploadFileAction;
|
||||
use Domain\Files\Resources\FileResource;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Files\Actions\UploadFileAction;
|
||||
use Support\Demo\Actions\FakeUploadFileAction;
|
||||
|
||||
class UploadFileController extends Controller
|
||||
@@ -22,8 +22,7 @@ class UploadFileController extends Controller
|
||||
*/
|
||||
public function __invoke(
|
||||
UploadRequest $request,
|
||||
): Response|array {
|
||||
|
||||
): Response | array {
|
||||
if (is_demo_account('howdy@hi5ve.digital')) {
|
||||
return ($this->fakeUploadFile)($request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Files\Resources;
|
||||
|
||||
use Domain\Sharing\Resources\ShareResource;
|
||||
@@ -40,10 +39,10 @@ class FileResource extends JsonResource
|
||||
),*/
|
||||
],
|
||||
'relationships' => [
|
||||
$this->mergeWhen($this->shared, fn() => [
|
||||
$this->mergeWhen($this->shared, fn () => [
|
||||
'shared' => new ShareResource($this->shared),
|
||||
]),
|
||||
$this->mergeWhen($this->parent, fn() => [
|
||||
$this->mergeWhen($this->parent, fn () => [
|
||||
'parent' => [
|
||||
'data' => [
|
||||
'type' => 'folder',
|
||||
@@ -54,7 +53,7 @@ class FileResource extends JsonResource
|
||||
],
|
||||
],
|
||||
]),
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
namespace Domain\Folders\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Folders\Actions\CreateFolderAction;
|
||||
use Domain\Folders\Requests\CreateFolderRequest;
|
||||
use Support\Demo\Actions\FakeCreateFolderAction;
|
||||
|
||||
@@ -203,6 +203,16 @@ class Folder extends Model
|
||||
->withPivot('permission');
|
||||
}
|
||||
|
||||
public function parents(): HasMany
|
||||
{
|
||||
return $this->hasMany(Folder::class, 'id', 'parent_id');
|
||||
}
|
||||
|
||||
public function teamRoot(): HasMany
|
||||
{
|
||||
return $this->parents()->with('teamRoot');
|
||||
}
|
||||
|
||||
// Delete all folder children
|
||||
public static function boot()
|
||||
{
|
||||
@@ -214,30 +224,28 @@ class Folder extends Model
|
||||
|
||||
static::deleting(function ($item) {
|
||||
if ($item->isForceDeleting()) {
|
||||
$item->trashedChildren()->each(function ($folder) {
|
||||
$folder->forceDelete();
|
||||
});
|
||||
$item
|
||||
->trashedChildren()
|
||||
->each(fn ($folder) => $folder->forceDelete());
|
||||
} else {
|
||||
$item->children()->each(function ($folder) {
|
||||
$folder->delete();
|
||||
});
|
||||
$item
|
||||
->children()
|
||||
->each(fn ($folder) => $folder->delete());
|
||||
|
||||
$item->files()->each(function ($file) {
|
||||
$file->delete();
|
||||
});
|
||||
$item
|
||||
->files()
|
||||
->each(fn ($file) => $file->delete());
|
||||
}
|
||||
});
|
||||
|
||||
// Restore children folders and files
|
||||
static::restoring(function ($item) {
|
||||
// Restore children folders
|
||||
$item->trashedChildren()->each(function ($folder) {
|
||||
$folder->restore();
|
||||
});
|
||||
|
||||
// Restore children files
|
||||
$item->trashedFiles()->each(function ($files) {
|
||||
$files->restore();
|
||||
});
|
||||
$item
|
||||
->trashedChildren()
|
||||
->each(fn ($folder) => $folder->restore());
|
||||
$item
|
||||
->trashedFiles()
|
||||
->each(fn ($files) => $files->restore());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Folders\Resources;
|
||||
|
||||
use Domain\Sharing\Resources\ShareResource;
|
||||
use Domain\Teams\Resources\TeamInvitationsCollection;
|
||||
use Domain\Teams\Resources\TeamMembersCollection;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Domain\Teams\Resources\TeamMembersCollection;
|
||||
use Domain\Teams\Resources\TeamInvitationsCollection;
|
||||
|
||||
class FolderResource extends JsonResource
|
||||
{
|
||||
@@ -34,16 +33,16 @@ class FolderResource extends JsonResource
|
||||
),*/
|
||||
],
|
||||
'relationships' => [
|
||||
$this->mergeWhen($this->teamMembers, fn() => [
|
||||
$this->mergeWhen($this->teamMembers, fn () => [
|
||||
'members' => new TeamMembersCollection($this->teamMembers),
|
||||
]),
|
||||
$this->mergeWhen($this->teamInvitations, fn() => [
|
||||
$this->mergeWhen($this->teamInvitations, fn () => [
|
||||
'invitations' => new TeamInvitationsCollection($this->teamInvitations),
|
||||
]),
|
||||
$this->mergeWhen($this->shared, fn() => [
|
||||
$this->mergeWhen($this->shared, fn () => [
|
||||
'shared' => new ShareResource($this->shared),
|
||||
]),
|
||||
$this->mergeWhen($this->parent, fn() => [
|
||||
$this->mergeWhen($this->parent, fn () => [
|
||||
'parent' => [
|
||||
'data' => [
|
||||
'type' => 'folder',
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
namespace Domain\Items\Actions;
|
||||
|
||||
use Domain\Files\Resources\FileResource;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Items\Requests\RenameItemRequest;
|
||||
|
||||
class RenameFileOrFolderAction
|
||||
@@ -14,7 +12,6 @@ class RenameFileOrFolderAction
|
||||
RenameItemRequest $request,
|
||||
string $id,
|
||||
) {
|
||||
|
||||
// Get item
|
||||
$item = get_item($request->input('type'), $id);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class RenameFileOrFolderController extends Controller
|
||||
public function __invoke(
|
||||
RenameItemRequest $request,
|
||||
string $id,
|
||||
): FileResource|FolderResource|array {
|
||||
): FileResource | FolderResource | array {
|
||||
if (is_demo_account(Auth::user()->email)) {
|
||||
return ($this->fakeRenameFileOrFolder)($request, $id);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
namespace Domain\Items\Controllers;
|
||||
|
||||
use Domain\Files\Resources\FileResource;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Files\Resources\FileResource;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Items\Requests\RenameItemRequest;
|
||||
use Domain\Items\Actions\RenameFileOrFolderAction;
|
||||
use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
namespace Domain\Localization\Controllers;
|
||||
|
||||
use Domain\Localization\Resources\LanguageCollection;
|
||||
use Domain\Localization\Resources\LanguageResource;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Settings\Models\Setting;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Localization\Models\Language;
|
||||
use Domain\Localization\Resources\LanguageResource;
|
||||
use Domain\Localization\Resources\LanguageCollection;
|
||||
use Domain\Localization\Requests\CreateLanguageRequest;
|
||||
use Domain\Localization\Requests\UpdateLanguageRequest;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace Domain\Sharing\Actions;
|
||||
|
||||
use Domain\Sharing\Notifications\SharedSendViaEmail;
|
||||
use Spatie\QueueableAction\QueueableAction;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Domain\Sharing\Notifications\SharedSendViaEmail;
|
||||
|
||||
class SendViaEmailAction
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Sharing\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
@@ -22,7 +21,7 @@ class ShareResource extends JsonResource
|
||||
'permission' => $this->permission,
|
||||
'protected' => $this->is_protected,
|
||||
'item_id' => $this->item_id,
|
||||
'expire_in' => (int)$this->expire_in,
|
||||
'expire_in' => (int) $this->expire_in,
|
||||
'token' => $this->token,
|
||||
'link' => $this->link,
|
||||
'type' => $this->type,
|
||||
|
||||
@@ -16,7 +16,7 @@ class BrowseSharedWithMeController
|
||||
|
||||
$relations = [
|
||||
'parent:id,name',
|
||||
'shared:token,id,item_id,permission,is_protected,expire_in'
|
||||
'shared:token,id,item_id,permission,is_protected,expire_in',
|
||||
];
|
||||
|
||||
if ($rootId) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace Domain\Teams\Controllers;
|
||||
|
||||
use Domain\Teams\Requests\ConvertIntoTeamFolderRequest;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Domain\Teams\Requests\ConvertIntoTeamFolderRequest;
|
||||
use Domain\Teams\Actions\InviteMembersIntoTeamFolderAction;
|
||||
|
||||
class ConvertFolderIntoTeamFolderController extends Controller
|
||||
@@ -18,7 +18,7 @@ class ConvertFolderIntoTeamFolderController extends Controller
|
||||
public function __invoke(
|
||||
ConvertIntoTeamFolderRequest $request,
|
||||
Folder $folder
|
||||
): ResponseFactory|Response {
|
||||
): ResponseFactory | Response {
|
||||
$folder->update([
|
||||
'team_folder' => 1,
|
||||
'parent_id' => null,
|
||||
|
||||
@@ -10,11 +10,9 @@ use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
|
||||
class InvitationsController extends Controller
|
||||
{
|
||||
|
||||
public function update(
|
||||
TeamFolderInvitation $invitation
|
||||
): ResponseFactory|Response {
|
||||
|
||||
): ResponseFactory | Response {
|
||||
$user = User::where('email', $invitation->email)
|
||||
->firstOrFail();
|
||||
|
||||
@@ -34,7 +32,7 @@ class InvitationsController extends Controller
|
||||
|
||||
public function destroy(
|
||||
TeamFolderInvitation $invitation
|
||||
): ResponseFactory|Response {
|
||||
): ResponseFactory | Response {
|
||||
$invitation->update([
|
||||
'status' => 'rejected',
|
||||
]);
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<?php
|
||||
namespace Domain\Teams\Controllers;
|
||||
|
||||
use DB;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Teams\Requests\CreateTeamFolderRequest;
|
||||
use Domain\Teams\Requests\UpdateTeamFolderMembersRequest;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Support\Str;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Domain\Teams\DTO\CreateTeamFolderData;
|
||||
use Domain\Files\Resources\FilesCollection;
|
||||
use Domain\Folders\Resources\FolderResource;
|
||||
use Domain\Teams\Actions\UpdateMembersAction;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Domain\Teams\Actions\UpdateInvitationsAction;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Domain\Teams\Requests\CreateTeamFolderRequest;
|
||||
use Domain\Teams\Requests\UpdateTeamFolderMembersRequest;
|
||||
use Domain\Teams\Actions\InviteMembersIntoTeamFolderAction;
|
||||
use Str;
|
||||
|
||||
class TeamFoldersController extends Controller
|
||||
{
|
||||
@@ -28,28 +26,35 @@ class TeamFoldersController extends Controller
|
||||
) {
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
public function show($id): array
|
||||
{
|
||||
$isHomepage = $id === 'undefined';
|
||||
$rootId = $id === 'undefined' ? null : $id;
|
||||
$requestedFolder = $rootId ? new FolderResource(Folder::findOrFail($rootId)) : null;
|
||||
$files = [];
|
||||
$teamRootFolder = null;
|
||||
|
||||
$folders = Folder::with([
|
||||
'teamMembers',
|
||||
'teamInvitations',
|
||||
'parent:id,name',
|
||||
'shared:token,id,item_id,permission,is_protected,expire_in'
|
||||
])
|
||||
->where('parent_id', $rootId)
|
||||
->where('team_folder', $isHomepage)
|
||||
$rootId = Str::isUuid($id) ? $id : null;
|
||||
$requestedFolder = $rootId ? Folder::findOrFail($rootId) : null;
|
||||
|
||||
$folders = Folder::where('parent_id', $rootId)
|
||||
->where('team_folder', ! Str::isUuid($id))
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
if (Str::isUuid($id)) {
|
||||
$files = File::with(['parent:id,name', 'shared:token,id,item_id,permission,is_protected,expire_in'])
|
||||
->where('folder_id', $rootId)
|
||||
if ($requestedFolder) {
|
||||
// Get root team folder
|
||||
$teamRootIdResults = recursiveFind(
|
||||
$requestedFolder->teamRoot->toArray(),
|
||||
'id'
|
||||
);
|
||||
|
||||
$teamRootId = end($teamRootIdResults);
|
||||
|
||||
$teamRootFolder = $teamRootId
|
||||
? Folder::findOrFail($teamRootId)
|
||||
: $requestedFolder;
|
||||
|
||||
// Get files
|
||||
$files = File::where('folder_id', $rootId)
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
->get();
|
||||
@@ -57,15 +62,16 @@ class TeamFoldersController extends Controller
|
||||
|
||||
// Collect folders and files to single array
|
||||
return [
|
||||
'folders' => new FolderCollection($folders),
|
||||
'files' => new FilesCollection($files),
|
||||
'root' => $requestedFolder,
|
||||
'folders' => new FolderCollection($folders),
|
||||
'files' => new FilesCollection($files),
|
||||
'root' => $requestedFolder ? new FolderResource($requestedFolder) : null,
|
||||
'teamFolder' => $teamRootFolder ? new FolderResource($teamRootFolder) : null,
|
||||
];
|
||||
}
|
||||
|
||||
public function store(
|
||||
CreateTeamFolderRequest $request,
|
||||
): ResponseFactory|Response {
|
||||
): ResponseFactory | Response {
|
||||
$data = CreateTeamFolderData::fromRequest($request);
|
||||
|
||||
$folder = Folder::create([
|
||||
@@ -85,7 +91,7 @@ class TeamFoldersController extends Controller
|
||||
Folder $folder,
|
||||
UpdateInvitationsAction $updateInvitations,
|
||||
UpdateMembersAction $updateMembers,
|
||||
): ResponseFactory|Response {
|
||||
): ResponseFactory | Response {
|
||||
$updateInvitations(
|
||||
$folder,
|
||||
$request->input('invitations')
|
||||
@@ -99,7 +105,7 @@ class TeamFoldersController extends Controller
|
||||
return response(new FolderResource($folder), 201);
|
||||
}
|
||||
|
||||
public function destroy(Folder $folder): ResponseFactory|Response
|
||||
public function destroy(Folder $folder): ResponseFactory | Response
|
||||
{
|
||||
// Delete existing invitations
|
||||
DB::table('team_folder_invitations')
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\DTO;
|
||||
|
||||
use Spatie\DataTransferObject\DataTransferObject;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Teams\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Domain\Browsing;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
namespace Tests\Domain\Sharing;
|
||||
|
||||
use Domain\Sharing\Notifications\SharedSendViaEmail;
|
||||
use Tests\TestCase;
|
||||
use App\Users\Models\User;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Domain\Sharing\Notifications\SharedSendViaEmail;
|
||||
|
||||
class UserShareTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ class VisitorBrowseTest extends TestCase
|
||||
'type' => 'shared',
|
||||
'attributes' => [
|
||||
'permission' => $share->permission,
|
||||
'protected' => false,
|
||||
'protected' => false,
|
||||
'item_id' => $share->item_id,
|
||||
'expire_in' => $share->expire_in,
|
||||
'token' => $share->token,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Domain\Teams;
|
||||
|
||||
use Notification;
|
||||
@@ -13,6 +12,31 @@ use Domain\Teams\Notifications\InvitationIntoTeamFolder;
|
||||
|
||||
class TeamsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_find_team_folder_id_from_children()
|
||||
{
|
||||
$teamFolder = Folder::factory()
|
||||
->create([
|
||||
'team_folder' => 1,
|
||||
]);
|
||||
|
||||
$level_1 = Folder::factory()
|
||||
->create([
|
||||
'parent_id' => $teamFolder->id,
|
||||
]);
|
||||
|
||||
$level_2 = Folder::factory()
|
||||
->create([
|
||||
'parent_id' => $level_1->id,
|
||||
]);
|
||||
|
||||
$teamRoot = recursiveFind($level_2->teamRoot->toArray(), 'id');
|
||||
|
||||
$this->assertEquals($teamFolder->id, end($teamRoot));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user