Merge branch '1.0.x' into directory

This commit is contained in:
Zach Copley 2011-03-01 19:36:11 -08:00
commit 09c90edbb5
10 changed files with 92 additions and 26 deletions

View File

@ -195,7 +195,7 @@ class ShowgroupAction extends GroupDesignAction
$notice = $this->group->getNotices(($this->page-1)*NOTICES_PER_PAGE,
NOTICES_PER_PAGE + 1);
$nl = new NoticeList($notice, $this);
$nl = new ThreadedNoticeList($notice, $this);
$cnt = $nl->show();
$this->pagination($this->page > 1,

View File

@ -186,6 +186,10 @@ class Profile extends Memcached_DataObject
$notice = $this->getNotices(0, 1);
if ($notice->fetch()) {
if ($notice instanceof ArrayWrapper) {
// hack for things trying to work with single notices
return $notice->_items[0];
}
return $notice;
} else {
return null;

View File

@ -575,16 +575,16 @@ var SN = { // StatusNet
// Find the threaded replies view we'll be adding to...
var list = notice.closest('.notices');
if (list.hasClass('threaded-notices')) {
if (list.hasClass('threaded-replies')) {
// We're replying to a reply; use reply form on the end of this list.
// We'll add our form at the end of this; grab the root notice.
parentNotice = list.closest('.notice');
} else {
// We're replying to a parent notice; pull its threaded list
// and we'll add on the end of it. Will add if needed.
list = $('ul.threaded-notices', notice);
list = $('ul.threaded-replies', notice);
if (list.length == 0) {
list = $('<ul class="notices threaded-notices xoxo"></ul>');
list = $('<ul class="notices threaded-replies xoxo"></ul>');
notice.append(list);
}
}
@ -654,8 +654,14 @@ var SN = { // StatusNet
var orig_li = $('li', data)[0];
if (orig_li) {
var li = document._importNode(orig_li, true);
var id = $(li).attr('id');
if ($("#"+id).length == 0) {
replyItem.replaceWith(li);
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
} else {
// Realtime came through before us...
replyItem.remove();
}
}
}
});
@ -726,7 +732,7 @@ var SN = { // StatusNet
},
NoticeInlineReplyPlaceholder: function(notice) {
var list = notice.find('ul.threaded-notices');
var list = notice.find('ul.threaded-replies');
var placeholder = $('<li class="notice-reply-placeholder">' +
'<input class="placeholder">' +
'</li>');
@ -744,7 +750,7 @@ var SN = { // StatusNet
* Uses 'live' rather than 'bind', so applies to future as well as present items.
*/
NoticeInlineReplySetup: function() {
$('.threaded-notices').each(function() {
$('.threaded-replies').each(function() {
var list = $(this);
var notice = list.closest('.notice');
SN.U.NoticeInlineReplyPlaceholder(notice);

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -287,6 +287,18 @@ class FavCommand extends Command
function handle($channel)
{
$notice = $this->getNotice($this->other);
$fave = new Fave();
$fave->user_id = $this->user->id;
$fave->notice_id = $notice->id;
$fave->find();
if ($fave->fetch()) {
// TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
$channel->error($this->user, _('Could not create favorite: already favorited.'));
return;
}
$fave = Fave::addNew($this->user->getProfile(), $notice);
if (!$fave) {
@ -300,7 +312,7 @@ class FavCommand extends Command
$other = User::staticGet('id', $notice->profile_id);
if ($other && $other->id != $user->id) {
if ($other && $other->id != $this->user->id) {
if ($other->email && $other->emailnotifyfav) {
mail_notify_fave($other, $this->user, $notice);
}

View File

@ -64,7 +64,7 @@ class ThreadedNoticeList extends NoticeList
{
$this->out->elementStart('div', array('id' =>'notices_primary'));
$this->out->element('h2', null, _('Notices'));
$this->out->elementStart('ol', array('class' => 'notices xoxo'));
$this->out->elementStart('ol', array('class' => 'notices threaded-notices xoxo'));
$cnt = 0;
$conversations = array();
@ -182,7 +182,7 @@ class ThreadedNoticeListItem extends NoticeListItem
}
if ($notices) {
$this->out->elementStart('ul', 'notices threaded-notices xoxo');
$this->out->elementStart('ul', 'notices threaded-replies xoxo');
if ($moreCutoff) {
$item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
$item->show();

View File

@ -0,0 +1,9 @@
.fake: all clean
all: realtimeupdate.min.js
clean:
rm -f realtimeupdate.min.js
realtimeupdate.min.js: realtimeupdate.js
yui-compressor realtimeupdate.js > realtimeupdate.min.js

View File

@ -166,9 +166,44 @@ RealtimeUpdate = {
var noticeItem = RealtimeUpdate.makeNoticeItem(data);
var noticeItemID = $(noticeItem).attr('id');
$("#notices_primary .notices").prepend(noticeItem);
$("#notices_primary .notice:first").css({display:"none"});
$("#notices_primary .notice:first").fadeIn(1000);
var list = $("#notices_primary .notices:first")
var prepend = true;
var threaded = list.hasClass('threaded-notices');
if (threaded && data.in_reply_to_status_id) {
// aho!
var parent = $('#notice-' + data.in_reply_to_status_id);
if (parent.length == 0) {
// @todo fetch the original, insert it, and finish the rest
} else {
// Check the parent notice to make sure it's not a reply itself.
// If so, use it's parent as the parent.
var parentList = parent.closest('.notices');
if (parentList.hasClass('threaded-replies')) {
parent = parentList.closest('.notice');
}
list = parent.find('.threaded-replies');
if (list.length == 0) {
list = $('<ul class="notices threaded-replies xoxo"></ul>');
parent.append(list);
}
prepend = false;
}
}
var newNotice = $(noticeItem);
if (prepend) {
list.prepend(newNotice);
} else {
var placeholder = list.find('li.notice-reply-placeholder')
if (placeholder.length > 0) {
newNotice.insertBefore(placeholder)
} else {
newNotice.appendTo(list);
SN.U.NoticeInlineReplyPlaceholder(parent);
}
}
newNotice.css({display:"none"}).fadeIn(1000);
SN.U.NoticeReplyTo($('#'+noticeItemID));
SN.U.NoticeWithAttachment($('#'+noticeItemID));

File diff suppressed because one or more lines are too long

View File

@ -1106,38 +1106,38 @@ border-top-style:solid;
}
/* Threaded notices sublist */
#content .notices .threaded-notices {
#content .notices .threaded-replies {
margin-left: 10%;
width: 90%;
background: #e4e8f1;
}
#content .threaded-notices .notice .author .photo {
#content .threaded-replies .notice .author .photo {
left: 8px;
width: 32px;
height: 32px;
}
.threaded-notices .notice-reply {
.threaded-replies .notice-reply {
margin: 8px;
}
.threaded-notices .notice-reply textarea,
.threaded-notices .notice-reply-placeholder input.placeholder {
.threaded-replies .notice-reply textarea,
.threaded-replies .notice-reply-placeholder input.placeholder {
margin-left: 0;
width: 95%;
}
.threaded-notices .notice-reply-placeholder input.placeholder {
.threaded-replies .notice-reply-placeholder input.placeholder {
color: gray;
margin-left: 8px; /* ?? */
margin-bottom: 8px;
}
.threaded-notices .notice-reply .controls {
.threaded-replies .notice-reply .controls {
text-align: right;
}
.threaded-notices .notice-reply-comments {
.threaded-replies .notice-reply-comments {
margin: 8px;
}
.threaded-notices .response,
.threaded-notices .source {
.threaded-replies .response,
.threaded-replies .source {
/* Hide these for ajax/realtime sourced notices */
display: none;
}