Merge branch '1.0.x' into testing
This commit is contained in:
commit
51a7e9961d
@ -1309,6 +1309,26 @@ class Notice extends Memcached_DataObject
|
||||
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.
|
||||
*
|
||||
|
@ -644,8 +644,8 @@ var SN = { // StatusNet
|
||||
// and we'll add on the end of it. Will add if needed.
|
||||
list = $('ul.threaded-replies', notice);
|
||||
if (list.length == 0) {
|
||||
list = $('<ul class="notices threaded-replies xoxo"></ul>');
|
||||
notice.append(list);
|
||||
SN.U.NoticeInlineReplyPlaceholder(notice);
|
||||
list = $('ul.threaded-replies', notice);
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,6 +718,11 @@ var SN = { // StatusNet
|
||||
|
||||
NoticeInlineReplyPlaceholder: function(notice) {
|
||||
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">' +
|
||||
'<input class="placeholder">' +
|
||||
'</li>');
|
||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
@ -202,20 +202,89 @@ class NoticeListItem extends Widget
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showAuthor()
|
||||
{
|
||||
$this->out->elementStart('div', 'author');
|
||||
|
||||
$this->out->elementStart('span', 'vcard author');
|
||||
|
||||
$attrs = array('href' => $this->profile->profileurl,
|
||||
'class' => 'url');
|
||||
if (!empty($this->profile->fullname)) {
|
||||
$attrs['title'] = $this->profile->getFancyName();
|
||||
}
|
||||
'class' => 'url',
|
||||
'title' => $this->profile->nickname);
|
||||
|
||||
$this->out->elementStart('a', $attrs);
|
||||
$this->showAvatar();
|
||||
$this->out->text(' ');
|
||||
$this->showNickname();
|
||||
$this->out->element('span',array('class' => 'nickname fn'),
|
||||
$this->profile->getBestName());
|
||||
$this->out->elementEnd('a');
|
||||
|
||||
$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
|
||||
}
|
||||
foreach (array_reverse($notices) as $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();
|
||||
Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice));
|
||||
}
|
||||
@ -248,6 +248,14 @@ class ThreadedNoticeListItem extends NoticeListItem
|
||||
// @todo FIXME: needs documentation.
|
||||
class ThreadedNoticeListSubItem extends NoticeListItem
|
||||
{
|
||||
protected $root = null;
|
||||
|
||||
function __construct($notice, $root, $out)
|
||||
{
|
||||
$this->root = $root;
|
||||
parent::__construct($notice, $out);
|
||||
}
|
||||
|
||||
function avatarSize()
|
||||
{
|
||||
return AVATAR_STREAM_SIZE; // @fixme would like something in between
|
||||
@ -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()
|
||||
{
|
||||
$item = new ThreadedNoticeListInlineFavesItem($this->notice, $this->out);
|
||||
|
Loading…
Reference in New Issue
Block a user