Page MenuHomePhorge

Portals: Rename unused newNoMenuItemsView() to newNoContentView()
AcceptedPublic

Authored by aklapper on Aug 14 2024, 12:58.

Details

Reviewers
valerio.bozzolan
Group Reviewers
O1: Blessed Committers
Summary

Followup to rPf8b8d88

Rename uncalled newNoMenuItemsView() to newNoContentView() overwriting this method in the parent class, to fix showing more specific UI messages for empty portals.

Test Plan

Code:

  • Grep the code for non-existing newNoMenuItemsView
  • Check code of parent class PhabricatorProfileMenuEngine

Workflows:

Diff Detail

Repository
rP Phorge
Branch
portalProfileMenu
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1677
Build 1677: arc lint + arc unit

Event Timeline

valerio.bozzolan added inline comments.
src/applications/dashboard/engine/PhabricatorDashboardPortalProfileMenuEngine.php
34–35

Interestingly, the method newNoMenuItemsView() seems orphan!

$ grep -RF -- '->newNoMenuItemsView' .
no results

So probably we can just drop this method

This revision now requires changes to proceed.Sun, Feb 2, 15:58
src/applications/dashboard/engine/PhabricatorDashboardPortalProfileMenuEngine.php
34–35

Uh right, thanks, seems https://we.phorge.it/rPdfe47157d322d3500f5eee204672cdb3d2c32c16 removed all except for this one, and creating an empty portal shows the strings defined in src/applications/search/engine/PhabricatorProfileMenuEngine.php instead.

aklapper retitled this revision from Fix newEmptyView() parameters in PhabricatorDashboardPortalProfileMenuEngine to Remove unused newNoMenuItemsView() function.Mon, Feb 3, 10:49
aklapper edited the summary of this revision. (Show Details)
aklapper edited the test plan for this revision. (Show Details)
aklapper retitled this revision from Remove unused newNoMenuItemsView() function to Fix newEmptyView() parameters in PhabricatorDashboardPortalProfileMenuEngine.
aklapper edited the summary of this revision. (Show Details)
aklapper edited the test plan for this revision. (Show Details)

Remove newNoMenuItemsView() instead

aklapper retitled this revision from Fix newEmptyView() parameters in PhabricatorDashboardPortalProfileMenuEngine to Remove unused newNoMenuItemsView() function.Mon, Feb 3, 10:50
aklapper edited the summary of this revision. (Show Details)
aklapper edited the test plan for this revision. (Show Details)
aklapper marked an inline comment as done.
src/applications/dashboard/engine/PhabricatorDashboardPortalProfileMenuEngine.php
34–35

Last comment promise... but I discovered that renaming to newNoContentView() ... renders something! with:

protected function newNoContentView(array $items) {
  $object = $this->getProfileObject();
  $builtins = $this->getBuiltinProfileItems($object);
  if (count($items) <= count($builtins)) {
    return $this->newEmptyView(
      pht('New Portal'),
      pht('Use "Edit Menu" to add menu items to this portal.'));
  } else {
    return $this->newEmptyView(
      pht('No Portal Content'),
      pht(
        'None of the visible menu items in this portal can render any '.
        'content.'),
    );
  }
}

With:

  • line 35 from newNoMenuItemsView to newNoContentView
  • line newNoContentView to be adjusted to avoid newNoContentView() (to avoid recursions)

In this case the test plan would be:

  • having a portal with nothing: renders first message
  • having a portal with just one "Divider": renders second message
  • having a portal with something useful (e.g. a Dashboard): shows the Dashboard

Right, PhabricatorDashboardPortalProfileMenuEngine extends PhabricatorProfileMenuEngine so we can override newNoContentView()... that probably makes most sense, thanks

Rename function to override from parent class, as proposed by Valerio

aklapper retitled this revision from Remove unused newNoMenuItemsView() function to Portals: Rename unused newNoMenuItemsView() to newNoContentView().Sun, Feb 16, 21:29
aklapper edited the summary of this revision. (Show Details)
aklapper edited the test plan for this revision. (Show Details)

having a portal with something useful (e.g. a Dashboard): shows the Dashboard

I have no freaking idea how to make portals show something useful, and I never understood the difference between portals and dashboards anyway, so I think I don't care. :)

As I uploaded a new diff now how do I request a new review / reset the existing one "Changes Requested"?
"Foist Upon", or which vaguely named oh so "funny" option from the "Add Action..." dropdown which makes non-native speakers feel stupid and be scared to choose the wrong option? Oh UX and usability...

Let's try again without celerity noise

Okay, got to wait until D25885 is merged first

Test plan works! Thanks :3

lgtm

This revision is now accepted and ready to land.Mon, Feb 17, 10:37