( context: ApplyTaskEditSubtaskChangesContext<TSubtask, TParent>, subtaskFile: TSubtask )
| 159 | } |
| 160 | |
| 161 | async function removeTaskEditSubtaskRelation< |
| 162 | TSubtask extends TaskEditSubtaskPathLike, |
| 163 | TParent extends TaskEditSubtaskParentLike, |
| 164 | >( |
| 165 | context: ApplyTaskEditSubtaskChangesContext<TSubtask, TParent>, |
| 166 | subtaskFile: TSubtask |
| 167 | ): Promise<boolean> { |
| 168 | const subtaskInfo = await context.getTaskInfo(subtaskFile.path); |
| 169 | if (!subtaskInfo) { |
| 170 | return false; |
| 171 | } |
| 172 | |
| 173 | const projectReference = context.buildProjectReference( |
| 174 | context.parentTaskFile, |
| 175 | subtaskFile.path |
| 176 | ); |
| 177 | const legacyReference = `[[${context.parentTaskFile.basename}]]`; |
| 178 | const updatedProjects = getTaskEditSubtaskProjectRemovalUpdate( |
| 179 | subtaskInfo.projects, |
| 180 | projectReference, |
| 181 | legacyReference |
| 182 | ); |
| 183 | |
| 184 | await context.updateTaskProjects(subtaskInfo, updatedProjects); |
| 185 | return true; |
| 186 | } |
no test coverage detected