Page MenuHomePhabricator

Convert Conpherence to use normal picture setting flows
ClosedPublic

Authored by chad on Oct 5 2016, 5:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 3:19 AM
Unknown Object (File)
Thu, Apr 25, 3:19 AM
Unknown Object (File)
Thu, Apr 25, 3:19 AM
Unknown Object (File)
Thu, Apr 25, 3:19 AM
Unknown Object (File)
Thu, Apr 25, 3:19 AM
Unknown Object (File)
Wed, Apr 24, 11:59 PM
Unknown Object (File)
Sat, Apr 20, 3:18 PM
Unknown Object (File)
Wed, Apr 10, 9:06 PM
Subscribers

Details

Summary

This moves room pictures out of the dialog and into it's own PictureController. Also adds a standard image (and removes the "last person to chat" picture (though we could add that back. My plan is though that direct messages use auto use the other person's photo, after we have editengine and room pictures will have a plain, replaceable image.

Test Plan

Set a new room picture, remove a picture. Run migration, see old images properly set with new image.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

chad retitled this revision from to [WIP] Convert Conpherence to use normal picture setting flows.
chad updated this object.
chad edited the test plan for this revision. (Show Details)
chad added a reviewer: epriestley.
  • fix bugs, build iterator
resources/sql/autopatches/20161005.conpherence.image.2.php
2

@epriestley don't think I've written a PHP migration before, can you spot check this before I fire it up on my test install. :D

resources/sql/autopatches/20161005.conpherence.image.2.php
11

This kind of thing is messy since if we put this in the migration, we can't delete the getImages() code (the migration will stop running as soon as we do, since the method won't exist anymore).

Instead, you should probably do this:

  • Use LiskRawMigrationIterator instead of LiskMigrationIterator.
  • Access imagePHIDs directly, then phutil_json_decode() it manually.
  • Use idx($that_thing, 'original') to get the original PHID (if I'm tracing the logic correctly).
  • Everything else is correct.

You can look at 20161004.cal.01.noepoch.php for a (more complicated) example of this. I had to do the same thing there because I plan to delete most of the columns/methods it references in a future chnage.

resources/sql/autopatches/20161005.conpherence.image.2.php
11

yeah, that was my intention, do this all at the DB level so I would be able to delete all the old code.

chad retitled this revision from [WIP] Convert Conpherence to use normal picture setting flows to Convert Conpherence to use normal picture setting flows.Oct 5 2016, 6:37 PM
chad updated this object.
chad edited the test plan for this revision. (Show Details)

I still have one final bug, if I try to reset to the default image twice, I get this fatal:

>>> UNRECOVERABLE FATAL ERROR <<<

Call to a member function getPHID() on boolean

/var/www/html/dev/core/lib/phabricator/src/applications/conpherence/editor/ConpherenceEditor.php:340


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻
src/applications/conpherence/editor/ConpherenceEditor.php
343

It's possible that there are no transactions left by the time we get here,, so end($xactions) might return false because $xactions is an empty array().

We can have no transactions if they were all removed because none of them did anything (e.g., set the title to the same thing, set the subtitle to the same thing, etc). We just drop transactions that don't have any effect. In this case, resetting an already-reset image is probably just being dropped.

I think we can just do something like this at the top?

if (!$xactions) {
  return $xactions;
}
  • skip final effects if no transactions

oh, thanks, easier than I thought

epriestley edited edge metadata.

Some minor nits inline, but this all looks correct to me. Nice job!

src/applications/conpherence/controller/ConpherenceController.php
71

Maybe stick the '/' inside the call, so you're passing the whole URI suffix to the call.

src/applications/conpherence/controller/ConpherenceRoomPictureController.php
25

(Is there a ->getURI() method? Is the canonical URI /Z123?)

111–113

You could use executeOne() to simplify this slightly.

src/applications/conpherence/editor/ConpherenceEditor.php
592–593

We should ideally still validate this, since it will be user-accessible again once we add API support.

I think thee correct validation is:

  • Is the value a file PHID which the user can see?

We could hold this until ModularTransactions / EditEngine, though. It's fine as-is today until we add API support (and not really dangerous if we forget about it, just the first step in a chain that could eventually cause a policy violation).

src/applications/conpherence/storage/ConpherenceThread.php
12–13

Maybe // TODO this for removal so we don't forget about it forever?

This revision is now accepted and ready to land.Oct 5 2016, 6:53 PM
This revision was automatically updated to reflect the committed changes.
chad marked 5 inline comments as done.