@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix task hovercards showing a "Not Editable" state

Summary:
Ref T13269. These cards really have three states:

- Editable: shows a pencil icon edit button.
- You Do Not Have Permission To Edit This: shows a "no editing" icon in red.
- Hovecard: shouldn't show anything.

However, the "hovercard" and "no permission" states are currently the same state, so when I made the "no permission" state more obvious that made the hovercard go all weird.

Make these states explicitly separate states.

Test Plan:
Looked at a...

- Editable card on workboard: edit state.
- No permission card on workboard: no permission state.
- Any hovercard: "not editable, this is a hovercard" state.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13269

Differential Revision: https://secure.phabricator.com/D20330

+31 -19
+1 -2
src/applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php
··· 47 47 48 48 $card = id(new ProjectBoardTaskCard()) 49 49 ->setViewer($viewer) 50 - ->setTask($task) 51 - ->setCanEdit(false); 50 + ->setTask($task); 52 51 53 52 $owner_phid = $task->getOwnerPHID(); 54 53 if ($owner_phid) {
+1
src/applications/project/engine/PhabricatorBoardRenderingEngine.php
··· 56 56 $card = id(new ProjectBoardTaskCard()) 57 57 ->setViewer($viewer) 58 58 ->setTask($object) 59 + ->setShowEditControls(true) 59 60 ->setCanEdit($this->getCanEdit($phid)); 60 61 61 62 $owner_phid = $object->getOwnerPHID();
+29 -17
src/applications/project/view/ProjectBoardTaskCard.php
··· 6 6 private $projectHandles; 7 7 private $task; 8 8 private $owner; 9 + private $showEditControls; 9 10 private $canEdit; 10 11 private $coverImageFile; 11 12 private $hideArchivedProjects; ··· 70 71 return $this->canEdit; 71 72 } 72 73 74 + public function setShowEditControls($show_edit_controls) { 75 + $this->showEditControls = $show_edit_controls; 76 + return $this; 77 + } 78 + 79 + public function getShowEditControls() { 80 + return $this->showEditControls; 81 + } 82 + 73 83 public function getItem() { 74 84 $task = $this->getTask(); 75 85 $owner = $this->getOwner(); ··· 89 99 ->setDisabled($task->isClosed()) 90 100 ->setBarColor($bar_color); 91 101 92 - if ($can_edit) { 93 - $card 94 - ->addSigil('draggable-card') 95 - ->addClass('draggable-card'); 96 - $edit_icon = 'fa-pencil'; 97 - } else { 98 - $card 99 - ->addClass('not-editable') 100 - ->addClass('undraggable-card'); 101 - $edit_icon = 'fa-lock red'; 102 + if ($this->getShowEditControls()) { 103 + if ($can_edit) { 104 + $card 105 + ->addSigil('draggable-card') 106 + ->addClass('draggable-card'); 107 + $edit_icon = 'fa-pencil'; 108 + } else { 109 + $card 110 + ->addClass('not-editable') 111 + ->addClass('undraggable-card'); 112 + $edit_icon = 'fa-lock red'; 113 + } 114 + 115 + $card->addAction( 116 + id(new PHUIListItemView()) 117 + ->setName(pht('Edit')) 118 + ->setIcon($edit_icon) 119 + ->addSigil('edit-project-card') 120 + ->setHref('/maniphest/task/edit/'.$task->getID().'/')); 102 121 } 103 - 104 - $card->addAction( 105 - id(new PHUIListItemView()) 106 - ->setName(pht('Edit')) 107 - ->setIcon($edit_icon) 108 - ->addSigil('edit-project-card') 109 - ->setHref('/maniphest/task/edit/'.$task->getID().'/')); 110 122 111 123 if ($owner) { 112 124 $card->addHandleIcon($owner, $owner->getName());