collective / Products.PloneKeywordManager

Change, merge and delete keywords (AKA tags or subjects) in Plone.
https://pypi.org/project/Products.PloneKeywordManager/
4 stars 8 forks source link

Undo #61

Open flipmcf opened 2 years ago

flipmcf commented 2 years ago

after I rename hundreds of thousands of objects - and then realize it was a bad idea - can I undo?

gforcada commented 2 years ago

That should be a transaction undo, right? 🤔 if we are not breaking that into smaller transactions... that can be complicated... one could annotate a transaction (I think one can, right? I never done that myself) and then search for those specific transactions to undo them... If meanwhile someone edited an object it might not be possible to undo the transaction 😕 maybe a confirmation dialog that XXX amount of objects are going to be updated? might avoid that?

flipmcf commented 2 years ago

I'm having the same thoughts.

The confirmation dialog is #60

Right now, I am pretty sure, that each object is changed with it's own transaction - editing hundreds of objects creates hundreds of single transactions - I think. https://github.com/collective/Products.PloneKeywordManager/blob/c0736d39d08f0fb108e661c655ccf1f7ec8a14ee/src/Products/PloneKeywordManager/tool.py#L135 https://github.com/collective/Products.PloneKeywordManager/blob/c0736d39d08f0fb108e661c655ccf1f7ec8a14ee/src/Products/PloneKeywordManager/tool.py#L101

The ZODB undo shows one transaction on '/prefs_keywords_view' but I haven't yet experimented with it.

So yeah, this is going to be tough. I like the annotation idea if we can't use an actual transaction, but that opens another can of worms when it comes to cleanup / packing. It's not responsible to leave that stuff hanging around forever.