Merge branch '0.8.x' of git@gitorious.org:statusnet/mainline into 0.8.x

This commit is contained in:
Sarven Capadisli 2009-09-20 12:55:34 +02:00
commit 0fa2bbe581
8 changed files with 48 additions and 19 deletions

View File

@ -136,6 +136,11 @@ class TwitapistatusesAction extends TwitterapiAction
} }
function home_timeline($args, $apidata)
{
call_user_func(array($this, 'friends_timeline'), $args, $apidata);
}
function user_timeline($args, $apidata) function user_timeline($args, $apidata)
{ {
parent::handle($args); parent::handle($args);

View File

@ -120,11 +120,15 @@ class User extends Memcached_DataObject
function allowed_nickname($nickname) function allowed_nickname($nickname)
{ {
// XXX: should already be validated for size, content, etc. // XXX: should already be validated for size, content, etc.
static $blacklist = array('rss', 'xrds', 'doc', 'main',
'settings', 'notice', 'user', $blacklist = array();
'search', 'avatar', 'tag', 'tags',
'api', 'message', 'group', 'groups', //all directory and file names should be blacklisted
'local'); $d = dir(INSTALLDIR);
while (false !== ($entry = $d->read())) {
$blacklist[]=$entry;
}
$d->close();
$merged = array_merge($blacklist, common_config('nickname', 'blacklist')); $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
return !in_array($nickname, $merged); return !in_array($nickname, $merged);
} }

View File

@ -418,9 +418,17 @@ class NoticeListItem extends Widget
function showContext() function showContext()
{ {
// XXX: also show context if there are replies to this notice $hasConversation = false;
if (!empty($this->notice->conversation) if( !empty($this->notice->conversation)
&& $this->notice->conversation != $this->notice->id) { && $this->notice->conversation != $this->notice->id){
$hasConversation = true;
}else{
$conversation = Notice::conversationStream($this->notice->id, 1, 1);
if($conversation->N > 0){
$hasConversation = true;
}
}
if ($hasConversation){
$convurl = common_local_url('conversation', $convurl = common_local_url('conversation',
array('id' => $this->notice->conversation)); array('id' => $this->notice->conversation));
$this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id, $this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,

View File

@ -272,12 +272,12 @@ class Router
$m->connect('api/statuses/:method', $m->connect('api/statuses/:method',
array('action' => 'api', array('action' => 'api',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?')); array('method' => '(public_timeline|home_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?'));
$m->connect('api/statuses/:method/:argument', $m->connect('api/statuses/:method/:argument',
array('action' => 'api', array('action' => 'api',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(|user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)')); array('method' => '(user_timeline|home_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)'));
// users // users
@ -436,7 +436,7 @@ class Router
$m->connect('api/statuses/:method/:argument', $m->connect('api/statuses/:method/:argument',
array('action' => 'api', array('action' => 'api',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(|user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)')); array('method' => '(user_timeline|home_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)'));
$m->connect('api/statusnet/groups/:method/:argument', $m->connect('api/statusnet/groups/:method/:argument',
array('action' => 'api', array('action' => 'api',

View File

@ -1,5 +1,7 @@
Autocomplete allows users to autocomplete screen names in @ replies. When an "@" is typed into the notice text area, an autocomplete box is displayed populated with the user's friends' screen names. Autocomplete allows users to autocomplete screen names in @ replies. When an "@" is typed into the notice text area, an autocomplete box is displayed populated with the user's friends' screen names.
Note: This plugin doesn't work if the site is in Private mode, i.e. when $config['site']['private'] is set to true.
Installation Installation
============ ============
Add "addPlugin('Autocomplete');" to the bottom of your config.php Add "addPlugin('Autocomplete');" to the bottom of your config.php

View File

@ -40,7 +40,7 @@ class InfiniteScrollPlugin extends Plugin
function onEndShowScripts($action) function onEndShowScripts($action)
{ {
$action->script('plugins/InfiniteScroll/jquery.infinitescroll.min.js'); $action->script('plugins/InfiniteScroll/jquery.infinitescroll.js');
$action->script('plugins/InfiniteScroll/infinitescroll.js'); $action->script('plugins/InfiniteScroll/infinitescroll.js');
} }
} }

View File

@ -1,6 +1,7 @@
jQuery(document).ready(function($){ jQuery(document).ready(function($){
$('notices_primary').infinitescroll({ $('notices_primary').infinitescroll({
debug: true, debug: true,
infiniteScroll : false,
nextSelector : "li.nav_next a", nextSelector : "li.nav_next a",
loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif', loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif',
text : "<em>Loading the next set of posts...</em>", text : "<em>Loading the next set of posts...</em>",
@ -12,4 +13,3 @@ jQuery(document).ready(function($){
NoticeAttachments(); NoticeAttachments();
}); });
}); });

View File

@ -92,14 +92,14 @@
if (props.isDuringAjax || props.isInvalidPage || props.isDone) return; if (props.isDuringAjax || props.isInvalidPage || props.isDone) return;
if ( !isNearBottom(opts,props) ) return; if ( opts.infiniteScroll && !isNearBottom(opts,props) ) return;
// we dont want to fire the ajax multiple times // we dont want to fire the ajax multiple times
props.isDuringAjax = true; props.isDuringAjax = true;
// show the loading message and hide the previous/next links // show the loading message and hide the previous/next links
props.loadingMsg.appendTo( opts.contentSelector ).show(); props.loadingMsg.appendTo( opts.contentSelector ).show();
$( opts.navSelector ).hide(); if(opts.infiniteScroll) $( opts.navSelector ).hide();
// increment the URL bit. e.g. /page/3/ // increment the URL bit. e.g. /page/3/
props.currPage++; props.currPage++;
@ -205,10 +205,19 @@
} }
}); });
// bind scroll handler to element (if its a local scroll) or window if(opts.infiniteScroll){
$(opts.localMode ? this : window) // bind scroll handler to element (if its a local scroll) or window
.bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } ) $(opts.localMode ? this : window)
.trigger('scroll.infscr'); // trigger the event, in case it's a short page .bind('scroll.infscr', function(){ infscrSetup(path,opts,props,callback); } )
.trigger('scroll.infscr'); // trigger the event, in case it's a short page
}else{
$(opts.nextSelector).click(
function(){
infscrSetup(path,opts,props,callback);
return false;
}
);
}
return this; return this;
@ -222,6 +231,7 @@
$.infinitescroll = { $.infinitescroll = {
defaults : { defaults : {
debug : false, debug : false,
infiniteScroll : true,
preload : false, preload : false,
nextSelector : "div.navigation a:first", nextSelector : "div.navigation a:first",
loadingImg : "http://www.infinite-scroll.com/loading.gif", loadingImg : "http://www.infinite-scroll.com/loading.gif",