Merge branch 'nightly' of gitorious.org:social/mainline into nightly

This commit is contained in:
Mikael Nordfeldth 2015-01-21 23:45:49 +01:00
commit fac9f4e545
6 changed files with 32 additions and 30 deletions

View File

@ -48,18 +48,9 @@ if (!defined('STATUSNET')) {
*/ */
class ApiAccountVerifyCredentialsAction extends ApiAuthAction class ApiAccountVerifyCredentialsAction extends ApiAuthAction
{ {
/** protected function handle()
* Handle the request
*
* Check whether the credentials are valid and output the result
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{ {
parent::handle($args); parent::handle();
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method. // TRANS: Client error displayed when coming across a non-supported API method.

View File

@ -53,7 +53,8 @@ class PublicAction extends Action
var $page = null; var $page = null;
var $notice; var $notice;
var $userProfile = null;
protected $stream = null;
function isReadOnly($args) function isReadOnly($args)
{ {
@ -67,7 +68,7 @@ class PublicAction extends Action
* *
* @return boolean success value * @return boolean success value
*/ */
function prepare($args) protected function prepare(array $args=array())
{ {
parent::prepare($args); parent::prepare($args);
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@ -80,17 +81,9 @@ class PublicAction extends Action
common_set_returnto($this->selfUrl()); common_set_returnto($this->selfUrl());
$this->userProfile = Profile::current(); $this->streamPrepare();
$user = common_current_user(); $this->notice = $this->stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
if (!empty($user) && $user->streamModeOnly()) {
$stream = new PublicNoticeStream($this->userProfile);
} else {
$stream = new ThreadingPublicNoticeStream($this->userProfile);
}
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
NOTICES_PER_PAGE + 1); NOTICES_PER_PAGE + 1);
if (!$this->notice) { if (!$this->notice) {
@ -98,7 +91,7 @@ class PublicAction extends Action
$this->serverError(_('Could not retrieve public timeline.')); $this->serverError(_('Could not retrieve public timeline.'));
} }
if($this->page > 1 && $this->notice->N == 0){ if ($this->page > 1 && $this->notice->N == 0){
// TRANS: Server error when page not found (404). // TRANS: Server error when page not found (404).
$this->serverError(_('No such page.'),$code=404); $this->serverError(_('No such page.'),$code=404);
} }
@ -106,6 +99,15 @@ class PublicAction extends Action
return true; return true;
} }
protected function streamPrepare()
{
if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
$this->stream = new PublicNoticeStream($this->scoped);
} else {
$this->stream = new ThreadingPublicNoticeStream($this->scoped);
}
}
/** /**
* handle request * handle request
* *
@ -115,9 +117,9 @@ class PublicAction extends Action
* *
* @return void * @return void
*/ */
function handle($args) protected function handle()
{ {
parent::handle($args); parent::handle();
$this->showPage(); $this->showPage();
} }
@ -222,7 +224,7 @@ class PublicAction extends Action
if (!empty($user) && $user->streamModeOnly()) { if (!empty($user) && $user->streamModeOnly()) {
$nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE)); $nl = new PrimaryNoticeList($this->notice, $this, array('show_n'=>NOTICES_PER_PAGE));
} else { } else {
$nl = new ThreadedNoticeList($this->notice, $this, $this->userProfile); $nl = new ThreadedNoticeList($this->notice, $this, $this->scoped);
} }
$cnt = $nl->show(); $cnt = $nl->show();

View File

@ -1570,7 +1570,12 @@ class Profile extends Managed_DataObject
} }
public function getPref($namespace, $topic, $default=null) { public function getPref($namespace, $topic, $default=null) {
// If you want an exception to be thrown, call Profile_prefs::getData directly
try {
return Profile_prefs::getData($this, $namespace, $topic, $default); return Profile_prefs::getData($this, $namespace, $topic, $default);
} catch (NoResultException $e) {
return null;
}
} }
public function setPref($namespace, $topic, $data) { public function setPref($namespace, $topic, $data) {

View File

@ -144,7 +144,7 @@ $default =
'path' => $_path . '/background/', 'path' => $_path . '/background/',
'ssl' => null), 'ssl' => null),
'public' => 'public' =>
array('localonly' => true, array('localonly' => false,
'blacklist' => array(), 'blacklist' => array(),
'autosource' => array()), 'autosource' => array()),
'theme' => 'theme' =>

View File

@ -163,6 +163,9 @@ class Router
$m->connect('main/'.$a, array('action' => $a)); $m->connect('main/'.$a, array('action' => $a));
} }
$m->connect('main/public', array('action' => 'public'));
$m->connect('main/all', array('action' => 'networkpublic'));
$m->connect('main/tagprofile/:id', array('action' => 'tagprofile'), $m->connect('main/tagprofile/:id', array('action' => 'tagprofile'),
array('id' => '[0-9]+')); array('id' => '[0-9]+'));
@ -945,7 +948,9 @@ class Router
array('tag' => self::REGEX_TAG)); array('tag' => self::REGEX_TAG));
} }
} else { } else {
$m->connect('main/public', array('action' => 'public'));
$m->connect('', array('action' => 'public')); $m->connect('', array('action' => 'public'));
$m->connect('main/all', array('action' => 'networkpublic'));
$m->connect('rss', array('action' => 'publicrss')); $m->connect('rss', array('action' => 'publicrss'));
$m->connect('featuredrss', array('action' => 'featuredrss')); $m->connect('featuredrss', array('action' => 'featuredrss'));
$m->connect('featured/', array('action' => 'featured')); $m->connect('featured/', array('action' => 'featured'));

View File

@ -1720,7 +1720,6 @@ ul.messages .notice .p-author {
} }
#content .threaded-replies .notice-options { #content .threaded-replies .notice-options {
position:absolute;
bottom:0; bottom:0;
right:0px; right:0px;
height:25px; height:25px;