protected sharing update

This commit is contained in:
carodej
2020-04-24 12:50:11 +02:00
parent c4b26d70b5
commit 586f0bba68
22 changed files with 446 additions and 164 deletions

View File

@@ -77,8 +77,8 @@ const actions = {
}
if (! back) context.commit('FLUSH_BROWSER_HISTORY')
context.commit('FLUSH_DATA')
context.commit('LOADING_STATE', true)
context.commit('FLUSH_DATA')
context.commit('LOADING_STATE', true)
// Create shared object for history
let trash = {
@@ -114,8 +114,8 @@ const actions = {
}
if (! back) context.commit('FLUSH_BROWSER_HISTORY')
context.commit('FLUSH_DATA')
context.commit('LOADING_STATE', true)
context.commit('FLUSH_DATA')
context.commit('LOADING_STATE', true)
// Create trash object for history
let trash = {

View File

@@ -29,10 +29,10 @@ const actions = {
})
.catch(() => isSomethingWrong())
},
changeItemName: ({commit, getters}, data) => {
renameItem: ({commit, getters}, data) => {
// Updated name in favourites panel
if (data.type === 'folder')
if (getters.permission === 'master' && data.type === 'folder')
commit('UPDATE_NAME_IN_FAVOURITES', data)
axios
@@ -69,7 +69,8 @@ const actions = {
.catch(error => {
reject(error)
context.commit('UPDATE_FILE_COUNT_PROGRESS', undefined)
// Reset uploader
commit('UPDATE_FILE_COUNT_PROGRESS', undefined)
})
})
},
@@ -100,10 +101,14 @@ const actions = {
// Remove file
commit('REMOVE_ITEM', data.unique_id)
if (data.type === 'folder')
commit('REMOVE_ITEM_FROM_FAVOURITES', data)
else
commit('REMOVE_ITEM_FROM_RECENT_UPLOAD', data.unique_id)
// Remove item from sidebar
if (getters.permission === 'master') {
if (data.type === 'folder')
commit('REMOVE_ITEM_FROM_FAVOURITES', data)
else
commit('REMOVE_ITEM_FROM_RECENT_UPLOAD', data.unique_id)
}
// Remove file preview
commit('CLEAR_FILEINFO_DETAIL')

View File

@@ -37,15 +37,11 @@ const actions = {
location: 'public'
}
let route = getters.sharedDetail.protected ? '/api/browse-private/' : '/api/browse-public/'
let route = getters.sharedDetail.protected ? '/api/browse-private/' : '/api/browse-public/' + router.currentRoute.params.token +'/'
return new Promise((resolve, reject) => {
axios
.get(route + currentFolder.unique_id, {
params: {
token: router.currentRoute.params.token
}
})
.get(route + currentFolder.unique_id)
.then(response => {
commit('LOADING_STATE', false)
@@ -76,9 +72,9 @@ const actions = {
},
getSingleFile: ({commit, state}) => {
let route = state.sharedDetail.protected ? '/api/file-private/' : '/api/file-public/'
let route = state.sharedDetail.protected ? '/api/file-private/' : '/api/file-public/' + router.currentRoute.params.token
axios.get(route + router.currentRoute.params.token)
axios.get(route)
.then(response => {
commit('STORE_SHARED_FILE', response.data)
})