Task deletion changes

Tasks can be deleted by whoever created them if they've not been
completed, have no subtasks and no reverse dependencies.
This commit is contained in:
Emmanuel BENOîT 2016-01-02 11:00:57 +01:00
parent a9035d5be6
commit a39945ff14

View file

@ -176,10 +176,12 @@ class DAO_Tasks
{
if ( $task->completed_by !== null ) {
$ts = strtotime( $task->completed_at );
return ( time() - $ts > 7 * 3600 * 24 );
return empty( $task->reverseDependencies )
&& ( time() - $ts > 7 * 3600 * 24 );
}
$ts = strtotime( $task->added_at );
return ( time() - $ts < 600 ) && ( $task->uid == $_SESSION[ 'uid' ] );
return empty( $task->subtasks )
&& empty( $task->reverseDependencies )
&& ( $task->uid == $_SESSION[ 'uid' ] );
}