Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone cards while cloning boards #3691

Closed
wants to merge 1 commit into from

Conversation

luka-nextcloud
Copy link
Contributor

Signed-off-by: Luka Trovic [email protected]

Summary

Duplicating a board copies its lists, but not the card.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Documentation (manuals or wiki) has been updated or is not required

Comment on lines +693 to +701
$newCard = new Card();
$newCard->setTitle($card->getTitle());
$newCard->setStackId($insertedStack->getId());
$newCard->setType($card->getType());
$newCard->setOrder($card->getOrder());
$newCard->setOwner($card->getOwner());
$newCard->setDescription($card->getDescription());
$newCard->setDuedate($card->getDuedate());
$newCard = $this->cardMapper->insert($newCard);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can isolate this process in a method inside Card entity.

Suggested change
$newCard = new Card();
$newCard->setTitle($card->getTitle());
$newCard->setStackId($insertedStack->getId());
$newCard->setType($card->getType());
$newCard->setOrder($card->getOrder());
$newCard->setOwner($card->getOwner());
$newCard->setDescription($card->getDescription());
$newCard->setDuedate($card->getDuedate());
$newCard = $this->cardMapper->insert($newCard);
$newCard = new Card();
$newCard->setFromCard($card);
$newCard->setStackId($insertedStack->getId());
$newCard = $this->cardMapper->insert($newCard);

or

Suggested change
$newCard = new Card();
$newCard->setTitle($card->getTitle());
$newCard->setStackId($insertedStack->getId());
$newCard->setType($card->getType());
$newCard->setOrder($card->getOrder());
$newCard->setOwner($card->getOwner());
$newCard->setDescription($card->getDescription());
$newCard->setDuedate($card->getDuedate());
$newCard = $this->cardMapper->insert($newCard);
$newCard = Card::copyFrom($card);
$newCard->setStackId($insertedStack->getId());
$newCard = $this->cardMapper->insert($newCard);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But Card is a RelationalEntity. Only accessors and mutators should be defined in it I think. I wanted to add it in CardService but CardService is already using BoardService so there is a dependency issue. What I think is to add a new layer or put it into CardMapper (but mappers are meant to be the ORM layer I think).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, you are right
Looks like we need to think more about it to create a wise solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can put the logic in a function just in case we need to isolate later on in a class.

@juliusknorr
Copy link
Member

As discussed in the call, lets:

  • Add a parameter to make the cloning of cards option in the backend
  • Trigger a dialog on the clone action in the frontend
  • Let the user decide if cards should be cloned as well or not (to still cover the use case of using a board as template)
  • While the clone request is running show a nice loading/progress indicator
  • Once done, show a done message and option to close or go to the cloned board

@juliusknorr
Copy link
Member

@luka-nextcloud As discussed lets rather focus on getting #3430 in as it also contains various options on the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicating a board copies its lists, but not the card
3 participants