Commit 51a7e996 authored by Evan Prodromou's avatar Evan Prodromou

Merge branch '1.0.x' into testing

parents 3ba4258f c06aba6b
...@@ -1309,6 +1309,26 @@ class Notice extends Memcached_DataObject ...@@ -1309,6 +1309,26 @@ class Notice extends Memcached_DataObject
return $ids; return $ids;
} }
/**
* Pull the complete list of @-reply targets for this notice.
*
* @return array of Profiles
*/
function getReplyProfiles()
{
$ids = $this->getReplies();
$profiles = array();
foreach ($ids as $id) {
$profile = Profile::staticGet('id', $id);
if (!empty($profile)) {
$profiles[] = $profile;
}
}
return $profiles;
}
/** /**
* Send e-mail notifications to local @-reply targets. * Send e-mail notifications to local @-reply targets.
* *
......
...@@ -644,8 +644,8 @@ var SN = { // StatusNet ...@@ -644,8 +644,8 @@ var SN = { // StatusNet
// and we'll add on the end of it. Will add if needed. // and we'll add on the end of it. Will add if needed.
list = $('ul.threaded-replies', notice); list = $('ul.threaded-replies', notice);
if (list.length == 0) { if (list.length == 0) {
list = $('<ul class="notices threaded-replies xoxo"></ul>'); SN.U.NoticeInlineReplyPlaceholder(notice);
notice.append(list); list = $('ul.threaded-replies', notice);
} }
} }
...@@ -718,6 +718,11 @@ var SN = { // StatusNet ...@@ -718,6 +718,11 @@ var SN = { // StatusNet
NoticeInlineReplyPlaceholder: function(notice) { NoticeInlineReplyPlaceholder: function(notice) {
var list = notice.find('ul.threaded-replies'); var list = notice.find('ul.threaded-replies');
if (list.length == 0) {
list = $('<ul class="notices threaded-replies xoxo"></ul>');
notice.append(list);
list = notice.find('ul.threaded-replies');
}
var placeholder = $('<li class="notice-reply-placeholder">' + var placeholder = $('<li class="notice-reply-placeholder">' +
'<input class="placeholder">' + '<input class="placeholder">' +
'</li>'); '</li>');
......
This diff is collapsed.
...@@ -202,20 +202,89 @@ class NoticeListItem extends Widget ...@@ -202,20 +202,89 @@ class NoticeListItem extends Widget
* *
* @return void * @return void
*/ */
function showAuthor() function showAuthor()
{ {
$this->out->elementStart('div', 'author');
$this->out->elementStart('span', 'vcard author'); $this->out->elementStart('span', 'vcard author');
$attrs = array('href' => $this->profile->profileurl, $attrs = array('href' => $this->profile->profileurl,
'class' => 'url'); 'class' => 'url',
if (!empty($this->profile->fullname)) { 'title' => $this->profile->nickname);
$attrs['title'] = $this->profile->getFancyName();
}
$this->out->elementStart('a', $attrs); $this->out->elementStart('a', $attrs);
$this->showAvatar(); $this->showAvatar();
$this->out->text(' '); $this->out->text(' ');
$this->showNickname(); $this->out->element('span',array('class' => 'nickname fn'),
$this->profile->getBestName());
$this->out->elementEnd('a'); $this->out->elementEnd('a');
$this->out->elementEnd('span'); $this->out->elementEnd('span');
$this->showAddressees();
$this->out->elementEnd('div');
}
function showAddressees()
{
$this->out->elementStart('span', 'addressees');
$cnt = $this->showGroupAddressees(true);
$cnt = $this->showProfileAddressees($cnt == 0);
$this->out->elementEnd('span', 'addressees');
}
function showGroupAddressees($first)
{
$groups = $this->getGroups();
foreach ($groups as $group) {
if (!$first) {
$this->out->text(', ');
} else {
$this->out->text(' ▶ ');
$first = false;
}
$this->out->element('a', array('href' => $group->homeUrl(),
'title' => $group->nickname,
'class' => 'addressee group'),
$group->getBestName());
}
return count($groups);
}
function getGroups()
{
return $this->notice->getGroups();
}
function showProfileAddressees($first)
{
$replies = $this->getReplyProfiles();
foreach ($replies as $reply) {
if (!$first) {
$this->out->text(', ');
} else {
$this->out->text(' ▶ ');
$first = false;
}
$this->out->element('a', array('href' => $reply->profileurl,
'title' => $reply->nickname,
'class' => 'addressee account'),
$reply->getBestName());
}
return count($replies);
}
function getReplyProfiles()
{
return $this->notice->getReplyProfiles();
} }
/** /**
......
...@@ -221,7 +221,7 @@ class ThreadedNoticeListItem extends NoticeListItem ...@@ -221,7 +221,7 @@ class ThreadedNoticeListItem extends NoticeListItem
} }
foreach (array_reverse($notices) as $notice) { foreach (array_reverse($notices) as $notice) {
if (Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice))) { if (Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice))) {
$item = new ThreadedNoticeListSubItem($notice, $this->out); $item = new ThreadedNoticeListSubItem($notice, $this->notice, $this->out);
$item->show(); $item->show();
Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice)); Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice));
} }
...@@ -248,6 +248,14 @@ class ThreadedNoticeListItem extends NoticeListItem ...@@ -248,6 +248,14 @@ class ThreadedNoticeListItem extends NoticeListItem
// @todo FIXME: needs documentation. // @todo FIXME: needs documentation.
class ThreadedNoticeListSubItem extends NoticeListItem class ThreadedNoticeListSubItem extends NoticeListItem
{ {
protected $root = null;
function __construct($notice, $root, $out)
{
$this->root = $root;
parent::__construct($notice, $out);
}
function avatarSize() function avatarSize()
{ {
return AVATAR_STREAM_SIZE; // @fixme would like something in between return AVATAR_STREAM_SIZE; // @fixme would like something in between
...@@ -268,6 +276,23 @@ class ThreadedNoticeListSubItem extends NoticeListItem ...@@ -268,6 +276,23 @@ class ThreadedNoticeListSubItem extends NoticeListItem
// //
} }
function getReplyProfiles()
{
$all = parent::getReplyProfiles();
$profiles = array();
$rootAuthor = $this->root->getProfile();
foreach ($all as $profile) {
if ($profile->id != $rootAuthor->id) {
$profiles[] = $profile;
}
}
return $profiles;
}
function showEnd() function showEnd()
{ {
$item = new ThreadedNoticeListInlineFavesItem($this->notice, $this->out); $item = new ThreadedNoticeListInlineFavesItem($this->notice, $this->out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment