Page MenuHomePhabricator

D8573.diff
No OneTemporary

D8573.diff

diff --git a/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php b/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php
--- a/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php
+++ b/src/applications/subscriptions/view/SubscriptionListDialogBuilder.php
@@ -56,7 +56,7 @@
->setClass('subscriber-list-dialog')
->setTitle($this->getTitle())
->appendChild($this->buildBody($this->getViewer(), $handles))
- ->addCancelButton($object_handle->getURI(), pht('Dismiss'));
+ ->addCancelButton($object_handle->getURI(), pht('Close'));
}
private function buildBody(PhabricatorUser $viewer, array $handles) {
@@ -64,11 +64,15 @@
$list = id(new PHUIObjectItemListView())
->setUser($viewer);
foreach ($handles as $handle) {
- // TODO - include $handle image - T4400
$item = id(new PHUIObjectItemView())
->setHeader($handle->getFullName())
->setHref($handle->getURI())
->setDisabled($handle->isDisabled());
+
+ if ($handle->getImageURI()) {
+ $item->setImageURI($handle->getImageURI());
+ }
+
$list->addItem($item);
}
diff --git a/src/applications/subscriptions/view/SubscriptionListStringBuilder.php b/src/applications/subscriptions/view/SubscriptionListStringBuilder.php
--- a/src/applications/subscriptions/view/SubscriptionListStringBuilder.php
+++ b/src/applications/subscriptions/view/SubscriptionListStringBuilder.php
@@ -48,25 +48,24 @@
private function buildString($list_uri) {
$handles = $this->getHandles();
- $html = array();
+ // Always show this many subscribers.
$show_count = 3;
$subscribers_count = count($handles);
- if ($subscribers_count <= $show_count) {
+
+ // It looks a bit silly to render "a, b, c, and 1 other", since we could
+ // have just put that other subscriber there in place of the "1 other"
+ // link. Instead, render "a, b, c, d" in this case, and then when we get one
+ // more render "a, b, c, and 2 others".
+ if ($subscribers_count <= ($show_count + 1)) {
return phutil_implode_html(', ', mpull($handles, 'renderLink'));
}
- $args = array('%s, %s, %s, and %s');
- $shown = 0;
- foreach ($handles as $handle) {
- $shown++;
- if ($shown > $show_count) {
- break;
- }
- $args[] = $handle->renderLink();
- }
+ $show = array_slice($handles, 0, $show_count);
+ $show = array_values($show);
+
$not_shown_count = $subscribers_count - $show_count;
$not_shown_txt = pht('%d other(s)', $not_shown_count);
- $args[] = javelin_tag(
+ $not_shown_link = javelin_tag(
'a',
array(
'href' => $list_uri,
@@ -74,7 +73,12 @@
),
$not_shown_txt);
- return call_user_func_array('pht', $args);
+ return pht(
+ '%s, %s, %s and %s',
+ $show[0]->renderLink(),
+ $show[1]->renderLink(),
+ $show[2]->renderLink(),
+ $not_shown_link);
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 1, 5:15 AM (4 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284310
Default Alt Text
D8573.diff (2 KB)

Event Timeline