fix(relations): don't allow creating relations which already exist

Resolves https://github.com/go-vikunja/frontend/issues/144
This commit is contained in:
kolaente 2024-01-26 23:37:59 +01:00
parent 314b101280
commit 33a47b7f43
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -165,7 +165,7 @@ func (rel *TaskRelation) Create(s *xorm.Session, a web.Auth) error {
exists, err := s.
Where("(task_id = ? AND other_task_id = ? AND relation_kind = ?) OR (task_id = ? AND other_task_id = ? AND relation_kind = ?)",
rel.TaskID, rel.OtherTaskID, rel.RelationKind, rel.TaskID, rel.OtherTaskID, rel.RelationKind).
Exist(rel)
Exist(&TaskRelation{})
if err != nil {
return err
}