creecros / MetaMagik

Custom Fields for Kanboard - Plugin MetaMagik
MIT License
99 stars 16 forks source link

The task creator will always be current user when import a task. #80

Closed uxyz-yang closed 1 year ago

uxyz-yang commented 2 years ago

Please check line 97 in "NewTaskCreationModel.php", the creator will be overwritten by the current logged in user, even if the column of creator in the csv template is filled .

if ($this->userSession->isLogged()) {
        $values['creator_id'] = $this->userSession->getId();
}

I also checked the original creation model in Kanboard repository, seems that it also has the same issue. (not sure)

creecros commented 2 years ago

I agree with the assessment, and would say that does indeed force the creator of a task to the "importee"

And I agree, this will happen in the native code of kanboard.

I could make an argument both ways though, so i am not really inclined to say it is an "issue". If you import a task, you are thus, the creator, which happens to fall into my definition of a "creator", however....why give someone the option to change the creator, and the behavior not work. It's like a "hahaha, gotcha ya" moment.

If I get a moment, i will update the code. If you want immediate solution:

if ($this->userSession->isLogged()) && !empty($values['creator_id']) {
        $values['creator_id'] = $this->userSession->getId();
}

might do the trick.

uxyz-yang commented 2 years ago

Thank you for your reply, this is also my current solution. 👍