mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
When an edit overrides an object lock, note it in the transaction record
Summary: Ref T13244. See PHI1059. When you lock a task, users who can edit the task can currently override the lock by using "Edit Task" if they confirm that they want to do this. Mark these edits with an emblem, similar to the "MFA" and "Silent" emblems, so it's clear that they may have bent the rules. Also, make the "MFA" and "Silent" emblems more easily visible. Test Plan: Edited a locked task, overrode the lock, got marked for it. {F6195005} Reviewers: amckinley Reviewed By: amckinley Subscribers: aeiser Maniphest Tasks: T13244 Differential Revision: https://secure.phabricator.com/D20131
This commit is contained in:
parent
2b718d78bb
commit
a20f108034
7 changed files with 89 additions and 6 deletions
|
@ -9,7 +9,7 @@ return array(
|
|||
'names' => array(
|
||||
'conpherence.pkg.css' => '3c8a0668',
|
||||
'conpherence.pkg.js' => '020aebcf',
|
||||
'core.pkg.css' => '08baca0c',
|
||||
'core.pkg.css' => '7a73ffc5',
|
||||
'core.pkg.js' => '5c737607',
|
||||
'differential.pkg.css' => 'b8df73d4',
|
||||
'differential.pkg.js' => '67c9ea4c',
|
||||
|
@ -157,7 +157,7 @@ return array(
|
|||
'rsrc/css/phui/phui-header-view.css' => '93cea4ec',
|
||||
'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0',
|
||||
'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec',
|
||||
'rsrc/css/phui/phui-icon.css' => '281f964d',
|
||||
'rsrc/css/phui/phui-icon.css' => '4cbc684a',
|
||||
'rsrc/css/phui/phui-image-mask.css' => '62c7f4d2',
|
||||
'rsrc/css/phui/phui-info-view.css' => '37b8d9ce',
|
||||
'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4',
|
||||
|
@ -823,7 +823,7 @@ return array(
|
|||
'phui-hovercard' => '074f0783',
|
||||
'phui-hovercard-view-css' => '6ca90fa0',
|
||||
'phui-icon-set-selector-css' => '7aa5f3ec',
|
||||
'phui-icon-view-css' => '281f964d',
|
||||
'phui-icon-view-css' => '4cbc684a',
|
||||
'phui-image-mask-css' => '62c7f4d2',
|
||||
'phui-info-view-css' => '37b8d9ce',
|
||||
'phui-inline-comment-view-css' => '48acce5b',
|
||||
|
|
|
@ -1115,6 +1115,16 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$transaction_open = true;
|
||||
}
|
||||
|
||||
// We can technically test any object for CAN_INTERACT, but we can
|
||||
// run into some issues in doing so (for example, in project unit tests).
|
||||
// For now, only test for CAN_INTERACT if the object is explicitly a
|
||||
// lockable object.
|
||||
|
||||
$was_locked = false;
|
||||
if ($object instanceof PhabricatorEditEngineLockableInterface) {
|
||||
$was_locked = !PhabricatorPolicyFilter::canInteract($actor, $object);
|
||||
}
|
||||
|
||||
foreach ($xactions as $xaction) {
|
||||
$this->applyInternalEffects($object, $xaction);
|
||||
}
|
||||
|
@ -1132,6 +1142,10 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
}
|
||||
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($was_locked) {
|
||||
$xaction->setIsLockOverrideTransaction(true);
|
||||
}
|
||||
|
||||
$xaction->setObjectPHID($object->getPHID());
|
||||
if ($xaction->getComment()) {
|
||||
$xaction->setPHID($xaction->generatePHID());
|
||||
|
|
|
@ -169,6 +169,14 @@ abstract class PhabricatorApplicationTransaction
|
|||
return (bool)$this->getMetadataValue('core.mfa', false);
|
||||
}
|
||||
|
||||
public function setIsLockOverrideTransaction($override) {
|
||||
return $this->setMetadataValue('core.lock-override', $override);
|
||||
}
|
||||
|
||||
public function getIsLockOverrideTransaction() {
|
||||
return (bool)$this->getMetadataValue('core.lock-override', false);
|
||||
}
|
||||
|
||||
public function attachComment(
|
||||
PhabricatorApplicationTransactionComment $comment) {
|
||||
$this->comment = $comment;
|
||||
|
@ -1529,6 +1537,12 @@ abstract class PhabricatorApplicationTransaction
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't group lock override and non-override transactions together.
|
||||
$is_override = $this->getIsLockOverrideTransaction();
|
||||
if ($is_override != $xaction->getIsLockOverrideTransaction()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -416,7 +416,8 @@ class PhabricatorApplicationTransactionView extends AphrontView {
|
|||
->setColor($xaction->getColor())
|
||||
->setHideCommentOptions($this->getHideCommentOptions())
|
||||
->setIsSilent($xaction->getIsSilentTransaction())
|
||||
->setIsMFA($xaction->getIsMFATransaction());
|
||||
->setIsMFA($xaction->getIsMFATransaction())
|
||||
->setIsLockOverride($xaction->getIsLockOverrideTransaction());
|
||||
|
||||
list($token, $token_removed) = $xaction->getToken();
|
||||
if ($token) {
|
||||
|
|
|
@ -19,6 +19,7 @@ final class PHUIIconView extends AphrontTagView {
|
|||
private $iconColor;
|
||||
private $iconBackground;
|
||||
private $tooltip;
|
||||
private $emblemColor;
|
||||
|
||||
public function setHref($href) {
|
||||
$this->href = $href;
|
||||
|
@ -66,6 +67,15 @@ final class PHUIIconView extends AphrontTagView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setEmblemColor($emblem_color) {
|
||||
$this->emblemColor = $emblem_color;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmblemColor() {
|
||||
return $this->emblemColor;
|
||||
}
|
||||
|
||||
protected function getTagName() {
|
||||
$tag = 'span';
|
||||
if ($this->href) {
|
||||
|
@ -106,6 +116,10 @@ final class PHUIIconView extends AphrontTagView {
|
|||
$this->appendChild($this->text);
|
||||
}
|
||||
|
||||
if ($this->emblemColor) {
|
||||
$classes[] = 'phui-icon-emblem phui-icon-emblem-'.$this->emblemColor;
|
||||
}
|
||||
|
||||
$sigil = null;
|
||||
$meta = array();
|
||||
if ($this->tooltip) {
|
||||
|
|
|
@ -31,6 +31,7 @@ final class PHUITimelineEventView extends AphrontView {
|
|||
private $pinboardItems = array();
|
||||
private $isSilent;
|
||||
private $isMFA;
|
||||
private $isLockOverride;
|
||||
|
||||
public function setAuthorPHID($author_phid) {
|
||||
$this->authorPHID = $author_phid;
|
||||
|
@ -197,6 +198,15 @@ final class PHUITimelineEventView extends AphrontView {
|
|||
return $this->isMFA;
|
||||
}
|
||||
|
||||
public function setIsLockOverride($is_override) {
|
||||
$this->isLockOverride = $is_override;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsLockOverride() {
|
||||
return $this->isLockOverride;
|
||||
}
|
||||
|
||||
public function setReallyMajorEvent($me) {
|
||||
$this->reallyMajorEvent = $me;
|
||||
return $this;
|
||||
|
@ -597,7 +607,8 @@ final class PHUITimelineEventView extends AphrontView {
|
|||
// not expect to have received any mail or notifications.
|
||||
if ($this->getIsSilent()) {
|
||||
$extra[] = id(new PHUIIconView())
|
||||
->setIcon('fa-bell-slash', 'red')
|
||||
->setIcon('fa-bell-slash', 'white')
|
||||
->setEmblemColor('red')
|
||||
->setTooltip(pht('Silent Edit'));
|
||||
}
|
||||
|
||||
|
@ -605,9 +616,17 @@ final class PHUITimelineEventView extends AphrontView {
|
|||
// provide a hint that it was extra authentic.
|
||||
if ($this->getIsMFA()) {
|
||||
$extra[] = id(new PHUIIconView())
|
||||
->setIcon('fa-vcard', 'pink')
|
||||
->setIcon('fa-vcard', 'white')
|
||||
->setEmblemColor('pink')
|
||||
->setTooltip(pht('MFA Authenticated'));
|
||||
}
|
||||
|
||||
if ($this->getIsLockOverride()) {
|
||||
$extra[] = id(new PHUIIconView())
|
||||
->setIcon('fa-chain-broken', 'white')
|
||||
->setEmblemColor('violet')
|
||||
->setTooltip(pht('Lock Overridden'));
|
||||
}
|
||||
}
|
||||
|
||||
$extra = javelin_tag(
|
||||
|
|
|
@ -183,3 +183,24 @@ a.phui-icon-view.phui-icon-square:hover {
|
|||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.phui-icon-emblem {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.phui-timeline-extra .phui-icon-emblem {
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
.phui-icon-emblem-violet {
|
||||
background-color: {$violet};
|
||||
}
|
||||
|
||||
.phui-icon-emblem-red {
|
||||
background-color: {$red};
|
||||
}
|
||||
|
||||
.phui-icon-emblem-pink {
|
||||
background-color: {$pink};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue