Ref T4863. Add project tags to workboard cards.
- Group Reviewers
- Maniphest Tasks
- T4863: Allow Workboard Cards to be customized for display
- Restricted Diffusion Commit
rP080d838c693b: Add project tags to workboard cards
This is inefficient because it does fetches per-card. If you load a board with a large number of cards that have projects, I expect you'll see roughly one query per unique project.
The simplest fix is probably to let PHUIHandleTagListView take a PhabricatorHandleList instead of only array $handles (it's generally sufficient to just remove the array typehint).
You can't unset() a handle list, so the new logic would look like:
$project_phids = array_fuse($task->getProjectPHIDs()); unset($project_phids[$this->project->getPHID()]); $handle_list = $viewer->loadHandles($project_phids); ...
That should bulk-fetch all the handles at render time in a single query.
Specifically, this will issue a query.
6 phabricator applications/maniphest/storage/ManiphestTask.php : 157 PhabricatorLiskDAO::assertAttached() 5 phabricator applications/project/view/ProjectBoardTaskCard.php : 86 ManiphestTask::getProjectPHIDs() 4 phabricator applications/project/controller/PhabricatorProjectMoveController.php : 158 ProjectBoardTaskCard::getItem() 3 phabricator aphront/configuration/AphrontApplicationConfiguration.php : 237 PhabricatorProjectMoveController::handleRequest() 2 phabricator aphront/configuration/AphrontApplicationConfiguration.php : 149 AphrontApplicationConfiguration::processRequest() 1 /Users/familyroom/Sites/phabricator/webroot/index.php : 17 AphrontApplicationConfiguration::runHTTPRequest()
I think the fix is just:
Basically, we can sort of cheat here since we have the $column, and each $column is associated with a project, so we can figure out which project the user must be looking at by figuring out which project the column belongs to.
Yeah, I think that's reasonable.
The code currently tries to be generic when possible to make possibly putting other types of objects (mocks, events, whatever) on workboards some day easier, but it's fine to just hard-code this to tasks for now.