Page MenuHomePhabricator

Pholio - fix a bug replacing multiple images
ClosedPublic

Authored by btrahan on Nov 8 2013, 11:46 PM.
Tags
None
Referenced Files
F13402937: D7536.id17000.diff
Thu, Jul 4, 7:24 PM
F13393828: D7536.id17003.diff
Wed, Jul 3, 2:36 AM
F13393827: D7536.id.diff
Wed, Jul 3, 2:36 AM
F13393826: D7536.id17000.diff
Wed, Jul 3, 2:36 AM
F13393649: D7536.diff
Wed, Jul 3, 1:12 AM
F13393061: D7536.diff
Tue, Jul 2, 9:21 PM
F13383775: D7536.diff
Sun, Jun 30, 1:00 PM
F13381181: D7536.diff
Sat, Jun 29, 9:43 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.)