diff --git a/cypress/integration/task/task.spec.js b/cypress/integration/task/task.spec.js index 83025aaa..e661f1d2 100644 --- a/cypress/integration/task/task.spec.js +++ b/cypress/integration/task/task.spec.js @@ -353,7 +353,7 @@ describe('Task', () => { .first() .click() - cy.get('.global-notification') + cy.get('.global-notification', { timeout: 4000 }) .should('contain', 'Success') cy.get('.task-view .details.labels-list .multiselect .input-wrapper span.tag') .should('exist') diff --git a/cypress/support/factory.js b/cypress/support/factory.js index 0c50bf8f..934f2fae 100644 --- a/cypress/support/factory.js +++ b/cypress/support/factory.js @@ -1,5 +1,4 @@ import {seed} from './seed' -import merge from 'lodash/merge' /** * A factory makes it easy to seed the database with data. @@ -25,7 +24,10 @@ export class Factory { const data = [] for (let i = 1; i <= count; i++) { - const entry = merge(this.factory(), override) + const entry = { + ...this.factory(), + ...override, + } for (const e in entry) { if(typeof entry[e] === 'function') { entry[e] = entry[e](i) diff --git a/package.json b/package.json index b2e62494..b83283f6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "dompurify": "2.3.3", "highlight.js": "11.2.0", "is-touch-device": "1.0.1", - "lodash": "4.17.21", "marked": "3.0.4", "register-service-worker": "1.7.2", "snake-case": "3.0.4", diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index 67e53562..d9a25f3a 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -178,9 +178,8 @@ import Fancycheckbox from '../../input/fancycheckbox' import flatPickr from 'vue-flatpickr-component' import 'flatpickr/dist/flatpickr.css' +import {includesById} from '@/helpers/utils' import {formatISO} from 'date-fns' -import differenceWith from 'lodash/differenceWith' - import PrioritySelect from '@/components/tasks/partials/prioritySelect.vue' import PercentDoneSelect from '@/components/tasks/partials/percentDoneSelect.vue' import Multiselect from '@/components/input/multiselect.vue' @@ -269,13 +268,7 @@ export default { }, computed: { foundLabels() { - const labels = (Object.values(this.$store.state.labels.labels).filter(l => { - return l.title.toLowerCase().includes(this.labelQuery.toLowerCase()) - }) ?? []) - - return differenceWith(labels, this.labels, (first, second) => { - return first.id === second.id - }) + return this.$store.getters['labels/filterLabelsByQuery'](this.labels, this.query) }, flatPickerConfig() { return { @@ -309,8 +302,13 @@ export default { this.prepareRelatedObjectFilter('namespace') this.prepareSingleValue('labels') - const labelIds = (typeof this.filters.labels === 'string' ? this.filters.labels : '').split(',').map(i => parseInt(i)) - this.labels = (Object.values(this.$store.state.labels.labels).filter(l => labelIds.includes(l.id)) ?? []) + + const labels = typeof this.filters.labels === 'string' + ? this.filters.labels + : '' + const labelIds = labels.split(',').map(i => parseInt(i)) + + this.labels = this.$store.getters['labels/getLabelsByIds'](labelIds) }, removePropertyFromFilter(propertyName) { // Because of the way arrays work, we can only ever remove one element at once. @@ -533,10 +531,10 @@ export default { this[`${kind}Service`].getAll({}, {s: query}) .then(response => { - // Filter the results to not include users who are already assigneid - this.$set(this, `found${kind}`, differenceWith(response, this[kind], (first, second) => { - return first.id === second.id - })) + // Filter users from the results who are already assigned + const unassignedUsers = response.filter(({id}) => !includesById(this[kind], id)) + + this.$set(this, `found${kind}`, unassignedUsers) }) .catch(e => { this.$message.error(e) diff --git a/src/components/tasks/mixins/taskList.js b/src/components/tasks/mixins/taskList.js index b15462f8..130e9390 100644 --- a/src/components/tasks/mixins/taskList.js +++ b/src/components/tasks/mixins/taskList.js @@ -1,5 +1,4 @@ import TaskCollectionService from '@/services/taskCollection' -import cloneDeep from 'lodash/cloneDeep' // FIXME: merge with DEFAULT_PARAMS in filters.vue const DEFAULT_PARAMS = { @@ -83,7 +82,7 @@ export default { this.tasks = r this.currentPage = page - this.loadedList = cloneDeep(currentList) + this.loadedList = JSON.parse(JSON.stringify(currentList)) }) .catch(e => { this.$message.error(e) diff --git a/src/components/tasks/partials/editAssignees.vue b/src/components/tasks/partials/editAssignees.vue index 9a666ee8..1fe0b398 100644 --- a/src/components/tasks/partials/editAssignees.vue +++ b/src/components/tasks/partials/editAssignees.vue @@ -29,8 +29,7 @@