mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02: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(
|
'names' => array(
|
||||||
'conpherence.pkg.css' => '3c8a0668',
|
'conpherence.pkg.css' => '3c8a0668',
|
||||||
'conpherence.pkg.js' => '020aebcf',
|
'conpherence.pkg.js' => '020aebcf',
|
||||||
'core.pkg.css' => '08baca0c',
|
'core.pkg.css' => '7a73ffc5',
|
||||||
'core.pkg.js' => '5c737607',
|
'core.pkg.js' => '5c737607',
|
||||||
'differential.pkg.css' => 'b8df73d4',
|
'differential.pkg.css' => 'b8df73d4',
|
||||||
'differential.pkg.js' => '67c9ea4c',
|
'differential.pkg.js' => '67c9ea4c',
|
||||||
|
@ -157,7 +157,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-header-view.css' => '93cea4ec',
|
'rsrc/css/phui/phui-header-view.css' => '93cea4ec',
|
||||||
'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0',
|
'rsrc/css/phui/phui-hovercard.css' => '6ca90fa0',
|
||||||
'rsrc/css/phui/phui-icon-set-selector.css' => '7aa5f3ec',
|
'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-image-mask.css' => '62c7f4d2',
|
||||||
'rsrc/css/phui/phui-info-view.css' => '37b8d9ce',
|
'rsrc/css/phui/phui-info-view.css' => '37b8d9ce',
|
||||||
'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4',
|
'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4',
|
||||||
|
@ -823,7 +823,7 @@ return array(
|
||||||
'phui-hovercard' => '074f0783',
|
'phui-hovercard' => '074f0783',
|
||||||
'phui-hovercard-view-css' => '6ca90fa0',
|
'phui-hovercard-view-css' => '6ca90fa0',
|
||||||
'phui-icon-set-selector-css' => '7aa5f3ec',
|
'phui-icon-set-selector-css' => '7aa5f3ec',
|
||||||
'phui-icon-view-css' => '281f964d',
|
'phui-icon-view-css' => '4cbc684a',
|
||||||
'phui-image-mask-css' => '62c7f4d2',
|
'phui-image-mask-css' => '62c7f4d2',
|
||||||
'phui-info-view-css' => '37b8d9ce',
|
'phui-info-view-css' => '37b8d9ce',
|
||||||
'phui-inline-comment-view-css' => '48acce5b',
|
'phui-inline-comment-view-css' => '48acce5b',
|
||||||
|
|
|
@ -1115,6 +1115,16 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
$transaction_open = true;
|
$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) {
|
foreach ($xactions as $xaction) {
|
||||||
$this->applyInternalEffects($object, $xaction);
|
$this->applyInternalEffects($object, $xaction);
|
||||||
}
|
}
|
||||||
|
@ -1132,6 +1142,10 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($xactions as $xaction) {
|
foreach ($xactions as $xaction) {
|
||||||
|
if ($was_locked) {
|
||||||
|
$xaction->setIsLockOverrideTransaction(true);
|
||||||
|
}
|
||||||
|
|
||||||
$xaction->setObjectPHID($object->getPHID());
|
$xaction->setObjectPHID($object->getPHID());
|
||||||
if ($xaction->getComment()) {
|
if ($xaction->getComment()) {
|
||||||
$xaction->setPHID($xaction->generatePHID());
|
$xaction->setPHID($xaction->generatePHID());
|
||||||
|
|
|
@ -169,6 +169,14 @@ abstract class PhabricatorApplicationTransaction
|
||||||
return (bool)$this->getMetadataValue('core.mfa', false);
|
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(
|
public function attachComment(
|
||||||
PhabricatorApplicationTransactionComment $comment) {
|
PhabricatorApplicationTransactionComment $comment) {
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
|
@ -1529,6 +1537,12 @@ abstract class PhabricatorApplicationTransaction
|
||||||
return false;
|
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;
|
return true;
|
||||||
|
|
|
@ -416,7 +416,8 @@ class PhabricatorApplicationTransactionView extends AphrontView {
|
||||||
->setColor($xaction->getColor())
|
->setColor($xaction->getColor())
|
||||||
->setHideCommentOptions($this->getHideCommentOptions())
|
->setHideCommentOptions($this->getHideCommentOptions())
|
||||||
->setIsSilent($xaction->getIsSilentTransaction())
|
->setIsSilent($xaction->getIsSilentTransaction())
|
||||||
->setIsMFA($xaction->getIsMFATransaction());
|
->setIsMFA($xaction->getIsMFATransaction())
|
||||||
|
->setIsLockOverride($xaction->getIsLockOverrideTransaction());
|
||||||
|
|
||||||
list($token, $token_removed) = $xaction->getToken();
|
list($token, $token_removed) = $xaction->getToken();
|
||||||
if ($token) {
|
if ($token) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
private $iconColor;
|
private $iconColor;
|
||||||
private $iconBackground;
|
private $iconBackground;
|
||||||
private $tooltip;
|
private $tooltip;
|
||||||
|
private $emblemColor;
|
||||||
|
|
||||||
public function setHref($href) {
|
public function setHref($href) {
|
||||||
$this->href = $href;
|
$this->href = $href;
|
||||||
|
@ -66,6 +67,15 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setEmblemColor($emblem_color) {
|
||||||
|
$this->emblemColor = $emblem_color;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmblemColor() {
|
||||||
|
return $this->emblemColor;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getTagName() {
|
protected function getTagName() {
|
||||||
$tag = 'span';
|
$tag = 'span';
|
||||||
if ($this->href) {
|
if ($this->href) {
|
||||||
|
@ -106,6 +116,10 @@ final class PHUIIconView extends AphrontTagView {
|
||||||
$this->appendChild($this->text);
|
$this->appendChild($this->text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->emblemColor) {
|
||||||
|
$classes[] = 'phui-icon-emblem phui-icon-emblem-'.$this->emblemColor;
|
||||||
|
}
|
||||||
|
|
||||||
$sigil = null;
|
$sigil = null;
|
||||||
$meta = array();
|
$meta = array();
|
||||||
if ($this->tooltip) {
|
if ($this->tooltip) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ final class PHUITimelineEventView extends AphrontView {
|
||||||
private $pinboardItems = array();
|
private $pinboardItems = array();
|
||||||
private $isSilent;
|
private $isSilent;
|
||||||
private $isMFA;
|
private $isMFA;
|
||||||
|
private $isLockOverride;
|
||||||
|
|
||||||
public function setAuthorPHID($author_phid) {
|
public function setAuthorPHID($author_phid) {
|
||||||
$this->authorPHID = $author_phid;
|
$this->authorPHID = $author_phid;
|
||||||
|
@ -197,6 +198,15 @@ final class PHUITimelineEventView extends AphrontView {
|
||||||
return $this->isMFA;
|
return $this->isMFA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setIsLockOverride($is_override) {
|
||||||
|
$this->isLockOverride = $is_override;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsLockOverride() {
|
||||||
|
return $this->isLockOverride;
|
||||||
|
}
|
||||||
|
|
||||||
public function setReallyMajorEvent($me) {
|
public function setReallyMajorEvent($me) {
|
||||||
$this->reallyMajorEvent = $me;
|
$this->reallyMajorEvent = $me;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -597,7 +607,8 @@ final class PHUITimelineEventView extends AphrontView {
|
||||||
// not expect to have received any mail or notifications.
|
// not expect to have received any mail or notifications.
|
||||||
if ($this->getIsSilent()) {
|
if ($this->getIsSilent()) {
|
||||||
$extra[] = id(new PHUIIconView())
|
$extra[] = id(new PHUIIconView())
|
||||||
->setIcon('fa-bell-slash', 'red')
|
->setIcon('fa-bell-slash', 'white')
|
||||||
|
->setEmblemColor('red')
|
||||||
->setTooltip(pht('Silent Edit'));
|
->setTooltip(pht('Silent Edit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,9 +616,17 @@ final class PHUITimelineEventView extends AphrontView {
|
||||||
// provide a hint that it was extra authentic.
|
// provide a hint that it was extra authentic.
|
||||||
if ($this->getIsMFA()) {
|
if ($this->getIsMFA()) {
|
||||||
$extra[] = id(new PHUIIconView())
|
$extra[] = id(new PHUIIconView())
|
||||||
->setIcon('fa-vcard', 'pink')
|
->setIcon('fa-vcard', 'white')
|
||||||
|
->setEmblemColor('pink')
|
||||||
->setTooltip(pht('MFA Authenticated'));
|
->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(
|
$extra = javelin_tag(
|
||||||
|
|
|
@ -183,3 +183,24 @@ a.phui-icon-view.phui-icon-square:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #fff;
|
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