Skip to content

Commit f45f8d3

Browse files
authored
Merge pull request #2319 from nextcloud/artonge/feat/photos_locations
Add config to select source directories
2 parents ce3ed19 + b110ae7 commit f45f8d3

72 files changed

Lines changed: 739 additions & 406 deletions

File tree

Some content is hidden

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

cypress/e2e/albums.cy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import {
3131
deleteSelection,
3232
favoriteSelection,
33+
mkdir,
3334
selectMedia,
3435
unfavoriteSelection,
3536
unselectMedia,
@@ -47,10 +48,11 @@ Cypress.on('uncaught:exception', (err) => {
4748
describe('Manage albums', { testIsolation: true }, () => {
4849
let user = null
4950

50-
beforeEach(function() {
51+
beforeEach(function () {
5152
cy.createRandomUser()
5253
.then(_user => {
5354
user = _user
55+
mkdir(user, '/Photos')
5456
uploadTestMedia(user)
5557
cy.login(user)
5658
})

cypress/e2e/photosUtils.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
*/
2020

2121
import type { User } from '@nextcloud/cypress'
22+
import axios from 'axios'
2223

23-
export function uploadTestMedia(user: User) {
24+
export function uploadTestMedia(user: User, destination = '/Photos') {
2425
cy.exec('ls cypress/fixtures/media')
2526
.then((result) => {
2627
for (const fileName of result.stdout.split('\n')) {
27-
cy.uploadFile(user, `media/${fileName}`, 'image/png', `/${fileName}`)
28+
cy.uploadFile(user, `media/${fileName}`, 'image/png', `/${destination}/${fileName}`)
2829
}
2930
})
3031
}
@@ -72,3 +73,26 @@ export function deleteSelection() {
7273
.click()
7374
.wait('@deleteRequests')
7475
}
76+
77+
export function mkdir(user: User, target: string) {
78+
// eslint-disable-next-line cypress/unsafe-to-chain-command
79+
cy.clearCookies()
80+
.then({ timeout: 8000 }, async () => {
81+
try {
82+
const rootPath = `${Cypress.env('baseUrl')}/remote.php/dav/files/${encodeURIComponent(user.userId)}`
83+
const filePath = target.split('/').map(encodeURIComponent).join('/')
84+
const response = await axios({
85+
url: `${rootPath}${filePath}`,
86+
method: 'MKCOL',
87+
auth: {
88+
username: user.userId,
89+
password: user.password,
90+
},
91+
})
92+
cy.log(`Created directory ${target}`, response)
93+
} catch (error) {
94+
cy.log('error', error)
95+
throw new Error('Unable to process fixture')
96+
}
97+
})
98+
}

cypress/e2e/places.cy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
2121
*/
22-
import { uploadTestMedia } from './photosUtils'
22+
import { mkdir, uploadTestMedia } from './photosUtils'
2323
import { navigateToPlace, runOccCommand } from './placesUtils'
2424

2525
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
@@ -31,9 +31,10 @@ Cypress.on('uncaught:exception', (err) => {
3131
})
3232

3333
describe('Manage places', () => {
34-
before(function() {
34+
before(function () {
3535
cy.createRandomUser()
3636
.then((user) => {
37+
mkdir(user, '/Photos')
3738
uploadTestMedia(user)
3839
runOccCommand('files:scan --all --generate-metadata')
3940
cy.login(user)

cypress/e2e/shared_albums.cy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
deleteSelection,
3535
downloadAllFiles,
3636
downloadSelection,
37+
mkdir,
3738
selectMedia,
3839
uploadTestMedia,
3940
} from './photosUtils'
@@ -64,6 +65,9 @@ describe('Manage shared albums', () => {
6465
cy.createUser(alice)
6566
cy.createUser(bob)
6667
cy.createUser(charlie)
68+
mkdir(alice, '/Photos')
69+
mkdir(bob, '/Photos')
70+
mkdir(charlie, '/Photos')
6771
uploadTestMedia(alice)
6872
uploadTestMedia(bob)
6973
uploadTestMedia(charlie)
@@ -302,6 +306,7 @@ describe('Manage shared albums', () => {
302306
cy.visit('apps/photos/sharedalbums')
303307
cy.get('body').should('not.contain', `shared_album_test7 (${alice.userId})`)
304308
cy.createUser(alice)
309+
mkdir(alice, '/Photos')
305310
uploadTestMedia(alice)
306311
})
307312
})

cypress/e2e/timelines.cy.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
deleteSelection,
3434
downloadSelection,
3535
favoriteSelection,
36+
mkdir,
3637
selectMedia,
3738
unfavoriteSelection,
3839
unselectMedia,
@@ -59,9 +60,11 @@ const bob = new User(`bob_${randHash()}`)
5960
describe('View list of photos in the main timeline', () => {
6061
before(() => {
6162
cy.createUser(alice).then(() => {
63+
mkdir(alice, '/Photos')
6264
uploadTestMedia(alice)
6365
})
6466
cy.createUser(bob).then(() => {
67+
mkdir(bob, '/Photos')
6568
uploadTestMedia(bob)
6669
})
6770
cy.login(alice)

js/photos-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/photos-main.js.LICENSE.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -391,28 +391,6 @@
391391
*
392392
*/
393393

394-
/**
395-
* @copyright Copyright (c) 2020 John Molakvoæ <[email protected]>
396-
*
397-
* @author John Molakvoæ <[email protected]>
398-
*
399-
* @license AGPL-3.0-or-later
400-
*
401-
* This program is free software: you can redistribute it and/or modify
402-
* it under the terms of the GNU Affero General Public License as
403-
* published by the Free Software Foundation, either version 3 of the
404-
* License, or (at your option) any later version.
405-
*
406-
* This program is distributed in the hope that it will be useful,
407-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
408-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
409-
* GNU Affero General Public License for more details.
410-
*
411-
* You should have received a copy of the GNU Affero General Public License
412-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
413-
*
414-
*/
415-
416394
/**
417395
* @copyright Copyright (c) 2020 John Molakvoæ <[email protected]>
418396
*
@@ -612,6 +590,28 @@
612590
*
613591
*/
614592

593+
/**
594+
* @copyright Copyright (c) 2024 Louis Chmn <[email protected]>
595+
*
596+
* @author Louis Chmn <[email protected]>
597+
*
598+
* @license AGPL-3.0-or-later
599+
*
600+
* This program is free software: you can redistribute it and/or modify
601+
* it under the terms of the GNU Affero General Public License as
602+
* published by the Free Software Foundation, either version 3 of the
603+
* License, or (at your option) any later version.
604+
*
605+
* This program is distributed in the hope that it will be useful,
606+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
607+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608+
* GNU Affero General Public License for more details.
609+
*
610+
* You should have received a copy of the GNU Affero General Public License
611+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
612+
*
613+
*/
614+
615615
/**
616616
* @license nested-property https://github.com/cosmosio/nested-property
617617
*

js/photos-main.js.map

Lines changed: 1 addition & 1 deletion
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_AlertCircle_vue-node_modules_vue-material-design-icons-9eee11.js

Lines changed: 3 additions & 0 deletions
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_PackageVariant_vue-node_modules_vue-material-design-ic-7ffa74.js.LICENSE.txt renamed to js/photos-node_modules_vue-material-design-icons_AlertCircle_vue-node_modules_vue-material-design-icons-9eee11.js.LICENSE.txt

File renamed without changes.

0 commit comments

Comments
 (0)