mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Instant subscribe/unsubscribe
Summary: No workflow dialog when subscribing or unsubscribing from a Differential Revision Test Plan: Repeatedly subscribe and unsubscribe to a revision. Enter refractory period due to speed of page gen. Reviewed By: epriestley Reviewers: epriestley CC: epriestley Differential Revision: 128
This commit is contained in:
parent
43449e49c0
commit
6d20a57ce0
4 changed files with 43 additions and 5 deletions
|
@ -159,6 +159,8 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
|
||||
$revision_detail->setActions($actions);
|
||||
|
||||
$revision_detail->setUser($user);
|
||||
|
||||
$comment_view = new DifferentialRevisionCommentListView();
|
||||
$comment_view->setComments($comments);
|
||||
$comment_view->setHandles($handles);
|
||||
|
@ -402,10 +404,10 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
if (!$viewer_is_owner && !$viewer_is_reviewer) {
|
||||
$action = $viewer_is_cc ? 'rem' : 'add';
|
||||
$links[] = array(
|
||||
'class' => $viewer_is_cc ? 'subscribe-rem' : 'subscribe-add',
|
||||
'href' => "/differential/subscribe/{$action}/{$revision_id}/",
|
||||
'name' => $viewer_is_cc ? 'Unsubscribe' : 'Subscribe',
|
||||
'sigil' => 'workflow',
|
||||
'class' => $viewer_is_cc ? 'subscribe-rem' : 'subscribe-add',
|
||||
'href' => "/differential/subscribe/{$action}/{$revision_id}/",
|
||||
'name' => $viewer_is_cc ? 'Unsubscribe' : 'Subscribe',
|
||||
'instant' => true,
|
||||
);
|
||||
} else {
|
||||
$links[] = array(
|
||||
|
|
|
@ -21,6 +21,7 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
private $revision;
|
||||
private $properties;
|
||||
private $actions;
|
||||
private $user;
|
||||
|
||||
public function setRevision($revision) {
|
||||
$this->revision = $revision;
|
||||
|
@ -37,6 +38,11 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setUser($user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
require_celerity_resource('differential-core-view-css');
|
||||
|
@ -65,6 +71,8 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
|||
$obj->setURI(idx($action, 'href'));
|
||||
$obj->setWorkflow(idx($action, 'sigil') == 'workflow');
|
||||
$obj->setClass(idx($action, 'class'));
|
||||
$obj->setInstant(idx($action, 'instant'));
|
||||
$obj->setUser($this->user);
|
||||
$actions[] = $obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ final class AphrontHeadsupActionView extends AphrontView {
|
|||
private $class;
|
||||
private $uri;
|
||||
private $workflow;
|
||||
private $instant;
|
||||
private $user;
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
|
@ -43,7 +45,31 @@ final class AphrontHeadsupActionView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setInstant($instant) {
|
||||
$this->instant = $instant;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUser($user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
if ($this->instant) {
|
||||
$button_class = $this->class.' link';
|
||||
return phabricator_render_form(
|
||||
$this->user,
|
||||
array(
|
||||
'action' => $this->uri,
|
||||
'method' => 'post',
|
||||
'style' => 'display: inline',
|
||||
),
|
||||
'<button class="'.$button_class.'">'.
|
||||
phutil_escape_html($this->name).
|
||||
'</button>'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->uri) {
|
||||
$tag = 'a';
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
}
|
||||
|
||||
.aphront-headsup-action-list a,
|
||||
.aphront-headsup-action-list span {
|
||||
.aphront-headsup-action-list span,
|
||||
.aphront-headsup-action-list button {
|
||||
background-position: 8px center;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
padding: 4px 4px 4px 32px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.aphront-headsup-action-list span.unavailable {
|
||||
|
|
Loading…
Reference in a new issue