diff --git a/cypress/e2e/task/task.spec.ts b/cypress/e2e/task/task.spec.ts
index b5fa3c57..af95b56c 100644
--- a/cypress/e2e/task/task.spec.ts
+++ b/cypress/e2e/task/task.spec.ts
@@ -80,6 +80,7 @@ describe('Task', () => {
describe('Task Detail View', () => {
beforeEach(() => {
TaskCommentFactory.truncate()
+ LabelTaskFactory.truncate()
})
it('Shows all task details', () => {
@@ -417,5 +418,27 @@ describe('Task', () => {
cy.get('.global-notification')
.should('contain', 'Success')
})
+
+ it('Can set a priority for a task', () => {
+ const tasks = TaskFactory.create(1, {
+ id: 1,
+ })
+ cy.visit(`/tasks/${tasks[0].id}`)
+
+ cy.get('.task-view .action-buttons .button')
+ .contains('Set Priority')
+ .click()
+ cy.get('.task-view .columns.details .column')
+ .contains('Priority')
+ .get('.select select')
+ .select('Urgent')
+ cy.get('.global-notification')
+ .should('contain', 'Success')
+
+ cy.get('.task-view .columns.details .column')
+ .contains('Priority')
+ .get('.select select')
+ .should('have.value', '4')
+ })
})
})
diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue
index 434cb9ed..8c7606c9 100644
--- a/src/views/tasks/TaskDetailView.vue
+++ b/src/views/tasks/TaskDetailView.vue
@@ -39,7 +39,7 @@
@@ -443,7 +443,7 @@ import TaskModel, {TASK_DEFAULT_COLOR} from '@/models/task'
import type {ITask} from '@/modelTypes/ITask'
import type {IList} from '@/modelTypes/IList'
-import {PRIORITIES} from '@/constants/priorities'
+import {PRIORITIES, type Priority} from '@/constants/priorities'
import {RIGHTS} from '@/constants/rights'
import BaseButton from '@/components/base/BaseButton.vue'
@@ -676,21 +676,19 @@ function setFieldActive(fieldName: keyof typeof activeFields) {
}
async function saveTask(args?: {
- task: ITask,
- showNotification?: boolean,
- undoCallback?: () => void,
- }) {
- const {
- task: currentTask,
- showNotification,
- undoCallback,
- } = {
- ...{
- task: cloneDeep(task),
- showNotification: true,
- },
- ...args,
- }
+ task: ITask,
+ undoCallback?: () => void,
+}) {
+ const {
+ task: currentTask,
+ undoCallback,
+ } = {
+ ...{
+ task: cloneDeep(task),
+ },
+ ...args,
+ }
+
if (!canWrite.value) {
return
}
@@ -711,10 +709,6 @@ async function saveTask(args?: {
Object.assign(task, newTask)
setActiveFields()
- if (!showNotification) {
- return
- }
-
let actions = []
if (undoCallback !== null) {
actions = [{
@@ -760,6 +754,17 @@ async function toggleFavorite() {
Object.assign(task, newTask)
await namespaceStore.loadNamespacesIfFavoritesDontExist()
}
+
+async function setPriority(priority: Priority) {
+ const newTask: ITask = {
+ ...task,
+ priority,
+ }
+
+ return saveTask({
+ task: newTask,
+ })
+}