Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/store/systemtags.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ const mutations = {
}
},

/**
* Update tag files list
*
* @param {object} state vuex state
* @param {object} data destructuring object
* @param {number} data.id current tag id
*/
removeTag(state, { id }) {
Vue.delete(state.names, state.tags[id].displayName)
Vue.delete(state.tags, id)
},

/**
* Update tag files list
*
Expand All @@ -56,6 +68,13 @@ const mutations = {
* @param {object[]} data.files list of files
*/
updateTag(state, { id, files }) {
if (files.length === 0) {
// Remove this tag from the list if there's no files for it
Vue.delete(state.names, state.tags[id].displayName)
Vue.delete(state.tags, id)
return
}

// sort by last modified
const list = files.sort((a, b) => sortCompare(a, b, 'lastmod'))

Expand Down Expand Up @@ -92,6 +111,10 @@ const actions = {
* @param {object[]} data.files list of files
*/
updateTag(context, { id, files }) {
if (files.length === 0) {
// Remove this tag from the list if there's no files for it
context.commit('removeTag', { id })
}
context.commit('updateTag', { id, files })
},
}
Expand Down