1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Fix some more setIcon() issues

Summary: Fixes T11569. This fixes a known bad `setIcon()`. I also looked for more calls to `setIcon()` without success, and stubbed `setIcon()` so we're in good shape even if more exist.

Test Plan:
  - Grepped for `setIcon(` and manually inspect all 1,004 callsites to look for calls on `PHUIObjectItemView` objects.
  - Grepped for "high risk" callsites (`setIcon` in file after `PHUIObjectItemView`) and re-examined them. I identified these files with this command:

```
git ls-tree -r --name-only HEAD | xargs pcregrep -i -M -H -c --files-with-matches -o 'PHUIObjectItemView(.|\n)*setIcon'
```

There might be some more clever way to do that.
  - Since this only identified the callsites I already knew about and I don't have a ton of confidence that I didn't miss any, I put a stub in place that logs a deprecation warning. I'll file a followup to go clean these up in a month or so if the logs are clean.
  - Loaded Nuance, saw it work but warn.
  - Changed Nuance to use `setStatusIcon()`, loaded Nuance, no more fatal.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11569

Differential Revision: https://secure.phabricator.com/D16477
This commit is contained in:
epriestley 2016-08-31 09:47:22 -07:00
parent 991e49b711
commit 29957d196b
2 changed files with 15 additions and 3 deletions

View file

@ -16,21 +16,21 @@ final class NuanceConsoleController extends NuanceController {
id(new PHUIObjectItemView())
->setHeader(pht('Queues'))
->setHref($this->getApplicationURI('queue/'))
->setIcon('fa-align-left')
->setImageIcon('fa-align-left')
->addAttribute(pht('Manage Nuance queues.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Sources'))
->setHref($this->getApplicationURI('source/'))
->setIcon('fa-filter')
->setImageIcon('fa-filter')
->addAttribute(pht('Manage Nuance sources.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Items'))
->setHref($this->getApplicationURI('item/'))
->setIcon('fa-clone')
->setImageIcon('fa-clone')
->addAttribute(pht('Manage Nuance items.')));
$crumbs = $this->buildApplicationCrumbs();

View file

@ -171,6 +171,18 @@ final class PHUIObjectItemView extends AphrontTagView {
return $this;
}
/**
* This method has been deprecated, use @{method:setImageIcon} instead.
*
* @deprecated
*/
public function setIcon($icon) {
phlog(
pht('Deprecated call to setIcon(), use setImageIcon() instead.'));
return $this->setImageIcon($icon);
}
public function setStatusIcon($icon, $label = null) {
$this->statusIcon = array(
'icon' => $icon,