Git Product home page Git Product logo

Comments (2)

e-gaulue avatar e-gaulue commented on June 8, 2024

I may be wrong but I think the trouble code is there:

wekan/models/cards.js

Lines 587 to 593 in e73a44d

const _id = Cards.insert(this);
// Copy attachments
oldCard.attachments()
.forEach(att => {
copyFile(att, _id, fileStoreStrategyFactory);
});

When a card is inserted, there may be a control that disable this option to show 'attachements' if the card has no attachment. then attachment are created in the next block. But then should try a Cards.update(this) or something more sweet/targeted that retry to set this setting.

from wekan.

e-gaulue avatar e-gaulue commented on June 8, 2024

@xet7

OK, I got it.

When the card is inserted, the coverId key of the new card points to the previous attachment file _id.

When attachments have been copied, one should look for the _id of the new card new attachments whose key "meta.copyFrom" is equal to the current coverId key. Then, change this key, with this _id.

The trouble is copyFile is async. The best would be copyFile to return the _id of the new attachment in a Promise, and to wait for this Promise only for the copy of the cover attachment. I didn't go further because it would imply waiting, and I know wekan is really concerned with scalability (copying a board means possibly copying a lot of cards).

Another way would be copyFile to handle this coverId change when called from the copy card function... Sounds strange...

We could also consider, the situation completely differently and handle it at display time. If coverId points to an attachment not belonging to the current card, look for current card attachments whose "meta.copyFrom" is equal to the current coverId and then correct it. This should be efficient. And if not enough, we could add a flag on the new card after copy to trigger this only once, but I think this is needless. When displaying a card anyway, the Card object is built with all the data we need, and it's no more than a condition test.

Your opinions?

from wekan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.