Page MenuHomePhabricator

Pholio - fix a bug replacing multiple images
ClosedPublic

Authored by btrahan on Nov 8 2013, 11:46 PM.
Tags
None
Referenced Files
F14065742: D7536.diff
Tue, Nov 19, 6:08 AM
F14024538: D7536.id17003.diff
Thu, Nov 7, 10:39 AM
F14015198: D7536.id17003.diff
Sun, Nov 3, 3:25 PM
F14002643: D7536.diff
Fri, Oct 25, 8:53 PM
F13984973: D7536.id.diff
Oct 20 2024, 5:16 PM
Unknown Object (File)
Oct 5 2024, 11:34 AM
Unknown Object (File)
Oct 4 2024, 10:51 AM
Unknown Object (File)
Oct 3 2024, 8:54 PM

Details

Summary

these transactions should never merge since they are always created for a 1:1 replacement. (ie any merging would be implicitly erroneous). Fixes T4081

Test Plan

made a mock with three images and replaced all three successfully. replaced image A with image B, did not save, replaced image B with image C, then saved and verified transaction correctly showed image A replaced with image C.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/applications/pholio/editor/PholioMockEditor.php
294โ€“295

an alternative fix is

$u->getOldValue() == $v->getOldValue()

...which means these transactions are replacing the same image and can be merged. Again though, that never happens. I guess though this alternate fix is probably more correct given how editors are generally tolerable of garbage in.

epriestley added inline comments.
src/applications/pholio/editor/PholioMockEditor.php
294โ€“295

Yeah, I think this alternative is slightly more correct if you want to go with that.

btrahan updated this revision to Unknown Object (????).Nov 9 2013, 1:09 AM

alternate version

note its slightly funkier than what i commented on inline since transactions haven't had their values massaged at the time of merging. ergo, do the slightest amount of work to compare the correct values, which resembles the code in getCustomOldValue. Note $this->getCustomOldValue($object, $txn) will not work since we don't have $object handy here

Ah, makes sense. Code looks sensible to me.

(We could change the signature to include $object here, but this seems wholly reasonable.)