Skip to content

Commit 735ee79

Browse files
authored
Merge pull request #2786 from nextcloud/backport/2772/stable30
[stable30] feat: Ease opening photos picker in album content view
2 parents 137ad47 + 7404584 commit 735ee79

19 files changed

+26
-117
lines changed

cypress/e2e/albums.cy.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
addFilesToAlbumFromAlbum,
77
addFilesToAlbumFromAlbumFromHeader,
88
createAnAlbumFromAlbums,
9-
deleteAnAlbumFromAlbumContent,
109
goToAlbum,
1110
removeSelectionFromAlbum,
1211
} from './albumsUtils'
@@ -28,7 +27,7 @@ Cypress.on('uncaught:exception', (err) => {
2827
}
2928
})
3029

31-
describe('Manage albums', { testIsolation: true }, () => {
30+
describe('Manage albums', () => {
3231
let user = null
3332

3433
beforeEach(function () {

cypress/e2e/albumsUtils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export function addFilesToAlbumFromAlbum(albumName: string, itemsIndex: number[]
5151
}
5252

5353
export function addFilesToAlbumFromAlbumFromHeader(albumName: string, itemsIndex: number[]) {
54-
cy.contains('New').click()
5554
cy.contains('Add photos to this album').click()
5655
cy.get('.photos-picker__file-list').within(() => {
5756
selectMedia(itemsIndex)

js/photos-main.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-main.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_FolderMultipleImage_vue-src_views_AlbumContent_vue.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-node_modules_vue-material-design-icons_FolderMultipleImage_vue-src_views_AlbumContent_vue.js.license

-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ This file is generated from multiple sources. Included packages:
274274
- css-loader
275275
- version: 7.1.2
276276
- license: MIT
277-
- debounce
278-
- version: 1.2.1
279-
- license: MIT
280277
- decode-named-character-reference
281278
- version: 1.0.2
282279
- license: MIT

js/photos-node_modules_vue-material-design-icons_FolderMultipleImage_vue-src_views_AlbumContent_vue.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-public.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-public.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_debounce_index_js-node_modules_v-59130c.js

-2
This file was deleted.

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_debounce_index_js-node_modules_v-59130c.js.map

-1
This file was deleted.

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_debounce_index_js-node_modules_v-59130c.js.map.license

-1
This file was deleted.

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_vue-material-design-icons_Accoun-3940d6.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_debounce_index_js-node_modules_v-59130c.js.license js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_vue-material-design-icons_Accoun-3940d6.js.license

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ SPDX-License-Identifier: MIT
22
SPDX-License-Identifier: GPL-3.0-or-later
33
SPDX-License-Identifier: Apache-2.0
44
SPDX-FileCopyrightText: omahlama
5-
SPDX-FileCopyrightText: debounce developers
65
SPDX-FileCopyrightText: Rob Cresswell <[email protected]>
76
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
87
SPDX-FileCopyrightText: Evan You
@@ -19,9 +18,6 @@ This file is generated from multiple sources. Included packages:
1918
- blurhash
2019
- version: 2.0.5
2120
- license: MIT
22-
- debounce
23-
- version: 1.2.1
24-
- license: MIT
2521
- vue-loader
2622
- version: 15.11.1
2723
- license: MIT

js/photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_vue-material-design-icons_Accoun-3940d6.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
photos-vendors-node_modules_blurhash_dist_esm_index_js-node_modules_vue-material-design-icons_Accoun-3940d6.js.license

src/views/AlbumContent.vue

+9-91
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
<HeaderNavigation key="navigation"
1414
slot="header"
1515
slot-scope="{selectedFileIds, resetSelection}"
16-
:class="{'photos-navigation--uploading': uploader.queue?.length > 0}"
1716
:loading="loadingCollectionFiles"
1817
:params="{ albumName }"
1918
:path="'/' + albumName"
2019
:title="albumName"
2120
@refresh="fetchAlbumContent">
22-
<div v-if="album !== undefined && album.location !== ''" slot="subtitle" class="album__location">
21+
<div v-if="album !== undefined && album.location !== ''"
22+
slot="subtitle"
23+
class="album__location">
2324
<MapMarker />{{ album.location }}
2425
</div>
2526

@@ -35,12 +36,12 @@
3536
</template>
3637

3738
<template v-if="album !== undefined" slot="right">
38-
<UploadPicker :accept="allowedMimes"
39-
:context="uploadContext"
40-
:destination="albumAsFolder"
41-
:root="uploadContext.root"
42-
:multiple="true"
43-
@uploaded="onUpload" />
39+
<NcButton @click="showAddPhotosModal = true">
40+
<template #icon>
41+
<Plus :size="20" />
42+
</template>
43+
{{ t('photos', 'Add photos to this album' ) }}
44+
</NcButton>
4445

4546
<NcButton v-if="sharingEnabled"
4647
type="tertiary"
@@ -147,12 +148,8 @@
147148
<script>
148149
import { mapActions } from 'vuex'
149150

150-
import { Folder, addNewFileMenuEntry, removeNewFileMenuEntry, davParsePermissions } from '@nextcloud/files'
151-
import { getCurrentUser } from '@nextcloud/auth'
152151
import { NcActions, NcActionButton, NcButton, NcDialog, NcModal, NcEmptyContent, NcActionSeparator, NcLoadingIcon, isMobile } from '@nextcloud/vue'
153-
import { UploadPicker, getUploader } from '@nextcloud/upload'
154152
import { translate } from '@nextcloud/l10n'
155-
import debounce from 'debounce'
156153

157154
import Close from 'vue-material-design-icons/Close.vue'
158155
import Delete from 'vue-material-design-icons/Delete.vue'
@@ -162,7 +159,6 @@ import ImagePlus from 'vue-material-design-icons/ImagePlus.vue'
162159
import MapMarker from 'vue-material-design-icons/MapMarker.vue'
163160
import Pencil from 'vue-material-design-icons/Pencil.vue'
164161
import Plus from 'vue-material-design-icons/Plus.vue'
165-
import PlusSvg from '@mdi/svg/svg/plus.svg'
166162
import ShareVariant from 'vue-material-design-icons/ShareVariant.vue'
167163

168164
import FetchFilesMixin from '../mixins/FetchFilesMixin.js'
@@ -176,7 +172,6 @@ import CollectionContent from '../components/Collection/CollectionContent.vue'
176172
import PhotosPicker from '../components/PhotosPicker.vue'
177173
import HeaderNavigation from '../components/HeaderNavigation.vue'
178174

179-
import allowedMimes from '../services/AllowedMimes.js'
180175
import logger from '../services/logger.js'
181176

182177
export default {
@@ -206,7 +201,6 @@ export default {
206201
Pencil,
207202
Plus,
208203
ShareVariant,
209-
UploadPicker,
210204
},
211205

212206
mixins: [
@@ -224,26 +218,11 @@ export default {
224218

225219
data() {
226220
return {
227-
allowedMimes,
228-
229221
showAddPhotosModal: false,
230222
showManageCollaboratorView: false,
231223
showEditAlbumForm: false,
232224

233225
loadingAddCollaborators: false,
234-
235-
uploader: getUploader(),
236-
237-
/** @type {import('@nextcloud/files').Entry} */
238-
newFileMenuEntry: {
239-
id: 'album-add',
240-
displayName: t('photos', 'Add photos to this album'),
241-
enabled: (destination) => destination.basename === this.$route.params.albumName,
242-
/** Existing icon css class */
243-
iconSvgInline: PlusSvg,
244-
/** Function to be run after creation */
245-
handler: () => { this.showAddPhotosModal = true },
246-
},
247226
}
248227
},
249228

@@ -269,47 +248,17 @@ export default {
269248
return OC.Share !== undefined
270249
},
271250

272-
/**
273-
* The upload picker context
274-
* We're uploading to the album folder, and the backend handle
275-
* the writing to the default location as well as the album update.
276-
* The context is also used for the NewFileMenu.
277-
*
278-
* @return {Album&{route: string, root: string}}
279-
*/
280-
uploadContext() {
281-
return {
282-
...this.album,
283-
route: this.$route.name,
284-
root: `dav/photos/${getCurrentUser()?.uid}/albums`,
285-
}
286-
},
287-
288251
/**
289252
* @return {string} The album's filename based on its name. Useful to fetch the location information and content.
290253
*/
291254
albumFileName() {
292255
return this.$store.getters.getAlbumName(this.albumName)
293256
},
294-
295-
albumAsFolder() {
296-
return new Folder({
297-
...this.album,
298-
owner: getCurrentUser()?.uid ?? '',
299-
source: this.album?.source ?? '',
300-
permissions: davParsePermissions(this.album.permissions),
301-
})
302-
},
303257
},
304258

305259
async mounted() {
306260
this.fetchAlbum()
307261
this.fetchAlbumContent()
308-
addNewFileMenuEntry(this.newFileMenuEntry)
309-
},
310-
311-
destroyed() {
312-
removeNewFileMenuEntry(this.newFileMenuEntry)
313262
},
314263

315264
methods: {
@@ -368,15 +317,6 @@ export default {
368317
}
369318
},
370319

371-
/**
372-
* A new File has been uploaded, let's add it
373-
*
374-
* @param {Upload[]} uploads
375-
*/
376-
onUpload: debounce(function() {
377-
this.fetchAlbumContent()
378-
}, 500),
379-
380320
t: translate,
381321
},
382322
}
@@ -407,26 +347,4 @@ export default {
407347
color: var(--color-text-lighter);
408348
}
409349
}
410-
411-
.photos-navigation {
412-
position: relative;
413-
// Add space at the bottom for the progress bar.
414-
&--uploading {
415-
margin-bottom: 30px;
416-
}
417-
418-
:deep(.upload-picker) {
419-
.upload-picker__progress {
420-
position: absolute;
421-
bottom: -30px;
422-
left: 64px;
423-
margin: 0;
424-
}
425-
.upload-picker__cancel {
426-
position: absolute;
427-
bottom: -24px;
428-
right: 50px;
429-
}
430-
}
431-
}
432350
</style>

0 commit comments

Comments
 (0)