Skip to content

Commit 541a388

Browse files
authored
Merge pull request #1334 from nextcloud/artonge/feat/location_grouping_views
Add location grouping views
2 parents 680bbff + 77df935 commit 541a388

File tree

61 files changed

+1503
-179
lines changed

Some content is hidden

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

61 files changed

+1503
-179
lines changed

.github/workflows/cypress.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,20 @@ jobs:
9090
uses: actions/upload-artifact@v3
9191
if: always()
9292
with:
93-
name: snapshots
93+
name: snapshots_${{ matrix.containers }}
9494
path: cypress/snapshots
9595

96+
- name: Extract NC logs
97+
if: always()
98+
run: docker-compose --project-directory cypress logs > nextcloud.log
99+
100+
- name: Upload NC logs
101+
uses: actions/upload-artifact@v3
102+
if: always()
103+
with:
104+
name: nc_logs_${{ matrix.containers }}
105+
path: nextcloud.log
106+
96107
summary:
97108
runs-on: ubuntu-latest
98109
needs: [init, cypress]

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<commands>
3434
<command>OCA\Photos\Command\UpdateReverseGeocodingFilesCommand</command>
35-
<command>OCA\Photos\Command\MapMediaToLocationCommand</command>
35+
<command>OCA\Photos\Command\MapMediaToPlaceCommand</command>
3636
</commands>
3737

3838
<sabre>
@@ -46,6 +46,6 @@
4646
</sabre>
4747

4848
<background-jobs>
49-
<job>OCA\Photos\Jobs\AutomaticLocationMapperJob</job>
49+
<job>OCA\Photos\Jobs\AutomaticPlaceMapperJob</job>
5050
</background-jobs>
5151
</info>

appinfo/routes.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
'path' => '',
4747
]
4848
],
49+
['name' => 'page#index', 'url' => '/places/{path}', 'verb' => 'GET', 'postfix' => 'places',
50+
'requirements' => [
51+
'path' => '.*',
52+
],
53+
'defaults' => [
54+
'path' => '',
55+
]
56+
],
4957
[ 'name' => 'publicAlbum#get', 'url' => '/public/{token}', 'verb' => 'GET',
5058
'requirements' => [
5159
'token' => '.*',

cypress/e2e/albums.cy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,21 @@ describe('Manage albums', () => {
128128
cy.contains('Save').click()
129129
})
130130

131-
it('Edit an album\'s location', () => {
131+
it('Edit an album\'s place', () => {
132132
cy.get('[aria-label="Open actions menu"]').click()
133133
cy.contains('Edit album details').click()
134-
cy.get('form [name="location"]').clear().type('New location')
134+
cy.get('form [name="place"]').clear().type('New place')
135135
cy.contains('Save').click()
136136

137-
cy.contains('New location')
137+
cy.contains('New place')
138138

139139
cy.reload()
140140

141-
cy.contains('New location')
141+
cy.contains('New place')
142142

143143
cy.get('[aria-label="Open actions menu"]').click()
144144
cy.contains('Edit album details').click()
145-
cy.get('form [name="location"]').clear()
145+
cy.get('form [name="place"]').clear()
146146
cy.contains('Save').click()
147147
})
148148
})

cypress/e2e/places.cy.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* @copyright Copyright (c) 2022 Louis Chmn <[email protected]>
3+
*
4+
* @author Louis Chmn <[email protected]>
5+
*
6+
* @license AGPL-3.0-or-later
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
import { uploadTestMedia } from './photosUtils'
23+
import { navigateToPlace, runOccCommand } from './placesUtils'
24+
25+
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
26+
Cypress.on('uncaught:exception', (err) => {
27+
/* returning false here prevents Cypress from failing the test */
28+
if (resizeObserverLoopErrRe.test(err.message)) {
29+
return false
30+
}
31+
})
32+
33+
describe('Manage places', () => {
34+
before(function() {
35+
cy.createRandomUser()
36+
.then((user) => {
37+
uploadTestMedia(user)
38+
runOccCommand(`photos:map-media-to-place --user ${user.userId}`)
39+
cy.login(user)
40+
cy.visit('/apps/photos')
41+
})
42+
})
43+
44+
beforeEach(() => {
45+
cy.visit('apps/photos/places')
46+
})
47+
48+
it('Check that we detect some places out of the existing files', () => {
49+
cy.get('ul.collections__list li').should('have.length', 4)
50+
})
51+
52+
it('Navigate to place and check that it contains some files', () => {
53+
navigateToPlace('Lauris')
54+
cy.get('[data-test="media"]').should('have.length', 1)
55+
})
56+
})

cypress/e2e/placesUtils.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @copyright Copyright (c) 2023 Louis Chmn <[email protected]>
3+
*
4+
* @author Louis Chmn <[email protected]>
5+
*
6+
* @license AGPL-3.0-or-later
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
export function navigateToCollection(collectionType: string, collectionName: string) {
24+
cy.get('.app-navigation__list').contains(collectionType).click()
25+
cy.get('ul.collections__list').contains(collectionName).click()
26+
}
27+
28+
export function navigateToPlace(locationName: string) {
29+
navigateToCollection('Places', locationName)
30+
}
31+
32+
export function runOccCommand(command: string) {
33+
cy.exec(`docker exec --user www-data nextcloud-cypress-tests-photos php ./occ ${command}`)
34+
}

cypress/support/commands.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,3 @@ Cypress.Commands.add('uploadContent', (user, blob, mimeType, target) => {
113113
}
114114
})
115115
})
116-
117-
Cypress.Commands.add('runOccCommand', (command: string) => {
118-
cy.exec(`docker exec --user www-data nextcloud-cypress-tests-server php ./occ ${command}`)
119-
})

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.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_nextcloud_sharing_dist_index_js-node_modules_vue-material-design-icons_AccountGr-e8a447.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.

0 commit comments

Comments
 (0)