Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@ module.exports = {
],
globals: {
appName: true,
}
},
overrides: [
{
files: ['*.ts', '*.vue'],
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
},
},
],
}
2 changes: 1 addition & 1 deletion src/Photos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</NcContent>
</template>

<script>
<script lang='ts'>
import { getCurrentUser } from '@nextcloud/auth'
import { generateUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
Expand Down
2 changes: 1 addition & 1 deletion src/PhotosPublic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</NcContent>
</template>

<script>
<script lang='ts'>
import { generateUrl } from '@nextcloud/router'

import { NcContent, NcAppContent } from '@nextcloud/vue'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Actions/ActionDownload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</NcActionLink>
</template>

<script>
<script lang='ts'>
import { mapGetters } from 'vuex'

import { generateUrl } from '@nextcloud/router'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Actions/ActionFavorite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</NcActionButton>
</template>

<script>
<script lang='ts'>
import { mapActions, mapGetters } from 'vuex'
import Star from 'vue-material-design-icons/Star.vue'

Expand Down
28 changes: 9 additions & 19 deletions src/components/Albums/AlbumForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</template>
</CollaboratorsSelectionForm>
</template>
<script>
<script lang='ts'>
import { mapActions } from 'vuex'

import MapMarker from 'vue-material-design-icons/MapMarker.vue'
Expand All @@ -87,6 +87,8 @@
import { generateRemoteUrl } from '@nextcloud/router'

import CollaboratorsSelectionForm from './CollaboratorsSelectionForm.vue'
import type { Album, Collaborator } from '../../store/albums'
import type { PropType } from 'vue'

export default {
name: 'AlbumForm',
Expand All @@ -102,9 +104,8 @@
},

props: {
/** @type {import('vue').PropType<import('../../store/albums.js').Album|null>} */
album: {
type: Object,
type: Object as PropType<Album|null>,

Check warning on line 108 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L108

Added line #L108 was not covered by tests
default: null,
},
displayBackButton: {
Expand All @@ -123,24 +124,15 @@
},

computed: {
/**
* @return {boolean} Whether sharing is enabled.
*/
editMode() {
editMode(): boolean {

Check warning on line 127 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L127

Added line #L127 was not covered by tests
return this.album !== null
},

/**
* @return {boolean} Whether sharing is enabled.
*/
sharingEnabled() {
sharingEnabled(): boolean {

Check warning on line 131 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L131

Added line #L131 was not covered by tests
return OC.Share !== undefined
},

/**
* @return {string} The album's filename based on its name. Useful to fetch the location information and content.
*/
albumFileName() {
albumFileName(): string {

Check warning on line 135 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L135

Added line #L135 was not covered by tests
return this.$store.getters.getAlbumName(this.albumName)
},
},
Expand All @@ -159,8 +151,7 @@
methods: {
...mapActions(['createCollection', 'renameCollection', 'updateCollection']),

/** @param {import('../../store/albums.js').Collaborator[]} collaborators */
submit(collaborators = []) {
submit(collaborators: Collaborator[] = []) {

Check warning on line 154 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L154

Added line #L154 was not covered by tests
if (this.albumName === '' || this.loading) {
return
}
Expand All @@ -172,8 +163,7 @@
}
},

/** @param {import('../../store/albums.js').Collaborator[]} collaborators */
async handleCreateAlbum(collaborators = []) {
async handleCreateAlbum(collaborators: Collaborator[] = []) {

Check warning on line 166 in src/components/Albums/AlbumForm.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumForm.vue#L166

Added line #L166 was not covered by tests
try {
this.loading = true
let album = await this.createCollection({
Expand Down
28 changes: 7 additions & 21 deletions src/components/Albums/AlbumPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@done="albumCreatedHandler" />
</template>

<script>
<script lang='ts'>
import { mapGetters } from 'vuex'
import Plus from 'vue-material-design-icons/Plus.vue'
import ImageMultiple from 'vue-material-design-icons/ImageMultiple.vue'
Expand All @@ -62,6 +62,7 @@

import FetchCollectionsMixin from '../../mixins/FetchCollectionsMixin.js'
import AlbumForm from './AlbumForm.vue'
import type { Album } from '../../store/albums.js'

export default {
name: 'AlbumPicker',
Expand All @@ -77,11 +78,7 @@
},

filters: {
/**
* @param {string} fileId - The id of the file.
* @return {string}
*/
toCoverUrl(fileId) {
toCoverUrl(fileId: string): string {

Check warning on line 81 in src/components/Albums/AlbumPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumPicker.vue#L81

Added line #L81 was not covered by tests
return generateUrl(`/apps/photos/api/v1/preview/${fileId}?x=${64}&y=${64}`)
},
},
Expand All @@ -102,10 +99,7 @@
'sharedAlbums',
]),

/**
* @return {import('../../store/albums.js').Album[]}
*/
allAlbums() {
allAlbums(): Album[] {

Check warning on line 102 in src/components/Albums/AlbumPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumPicker.vue#L102

Added line #L102 was not covered by tests
return [...Object.values(this.albums), ...Object.values(this.sharedAlbums)]
},
},
Expand All @@ -125,23 +119,15 @@
this.fetchAlbumList()
},

pickAlbum(album) {
pickAlbum(album: Album) {

Check warning on line 122 in src/components/Albums/AlbumPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumPicker.vue#L122

Added line #L122 was not covered by tests
this.$emit('album-picked', album)
},

/**
* @param {object} album
* @return {boolean}
*/
isSharedAlbum(album) {
isSharedAlbum(album: Album): boolean {

Check warning on line 126 in src/components/Albums/AlbumPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumPicker.vue#L126

Added line #L126 was not covered by tests
return album.filename.match(/^\/photos\/.+\/sharedalbums\//) !== null
},

/**
* @param {object} album The album's full name, including the userid.
* @return {string} The album name without the userId between parentheses.
*/
originalName(album) {
originalName(album: Album): string {

Check warning on line 130 in src/components/Albums/AlbumPicker.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Albums/AlbumPicker.vue#L130

Added line #L130 was not covered by tests
if (this.isSharedAlbum(album)) {
return album.basename.replace(new RegExp(`\\(${album.collaborators[0].id}\\)$`), '')
} else {
Expand Down
Loading
Loading