Page MenuHomePhabricator

Add a one-click "Close" button to Maniphest
Closed, ResolvedPublic

Description

Minor product/technical issues:

  • Interaction with T1812. We can use the 'closed' special for now and deal with this later. This implies a minor doc update on D8584.
  • Very old IE and multi-button forms don't work, but I'm pretty sure we're far clear of all versions where this matters.
  • If you select a status in the dropdown and then click the "close" button, we should probably respect the dropdown version, not the button version.
  • If the task is already closed, but not in the closed state the button implies, I guess we hide it? Or do we "Reopen" into the 'default' special?

Event Timeline

epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added a project: Maniphest.
epriestley added subscribers: epriestley, carl.

(That's stacked on top of T1812 and @btrahan is away until Tuesdayish so it probably won't land until early next week.)

We're removing this button -- see some discussion in D9221. Users found the button's existence, placement, and behavior confusing. T5134 and T5083 have specific examples.

Would you be up for having a similar button in a different location? The other obvious place that comes to mind is in the button list in the top right (http://i.avtok.com/image/0Z1w1h1k0U3R).

The right answer is to (eventually) redesign the comment/action UX. We don't want to continue to add links to the action link area (see T4836)

The upper right list is extensible, let me make it a little easier to access and then I can give you a listener for it.

  • Wait for D9262.
  • Drop the file below into phabricator/src/extensions/.
  • No warranty, express or implied.
QuickCloseTaskListener.php
<?php

final class QuickCloseTaskListener
  extends PhabricatorAutoEventListener {

  public function register() {
    $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
  }

  public function handleEvent(PhutilEvent $event) {
    $task = $event->getValue('object');
    $actions = $event->getValue('actions');

    $close_status = ManiphestTaskStatus::getDefaultClosedStatus();
    $close_name = ManiphestTaskStatus::getTaskStatusName($close_status);

    $uri = id(new PhutilURI('/maniphest/transaction/save/'))
      ->setQueryParam('taskID', $task->getID())
      ->setQueryParam('action', 'status')
      ->setQueryParam('resolution', $close_status);

    $actions[] = id(new PhabricatorActionView())
      ->setIcon('fa-check-square-o')
      ->setRenderAsForm(true)
      ->setDisabled($task->isClosed())
      ->setHref($uri)
      ->setName(pht('Close Task'));

    $event->setValue('actions', $actions);
  }

}

Screen_Shot_2014-05-22_at_3.14.53_PM.png (348×415 px, 20 KB)

Alright, should be good to go at HEAD.

Whoops, try this one instead to fatal fewer other applications:

QuickCloseTaskListener.php
<?php

final class QuickCloseTaskListener
  extends PhabricatorAutoEventListener {

  public function register() {
    $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
  }

  public function handleEvent(PhutilEvent $event) {
    $task = $event->getValue('object');

    if (!($task instanceof ManiphestTask)) {
      return;
    }

    $actions = $event->getValue('actions');

    $close_status = ManiphestTaskStatus::getDefaultClosedStatus();
    $close_name = ManiphestTaskStatus::getTaskStatusName($close_status);

    $uri = id(new PhutilURI('/maniphest/transaction/save/'))
      ->setQueryParam('taskID', $task->getID())
      ->setQueryParam('action', 'status')
      ->setQueryParam('resolution', $close_status);

    $actions[] = id(new PhabricatorActionView())
      ->setIcon('fa-check-square-o')
      ->setRenderAsForm(true)
      ->setDisabled($task->isClosed())
      ->setHref($uri)
      ->setName(pht('Close Task'));

    $event->setValue('actions', $actions);
  }

}

We don't plan to restore this to the upstream. T4657#24 offers a way to add an action link with the same effect instead.

So for us "Close task" doesn't work anymore, looks like you just have deleted the code which processed the button. Is there any replacement for this I don't know or you have just deleted a nice convenient feature which worked fine for some people like we are?