forked from GNUsocial/gnu-social
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.8.x
This commit is contained in:
commit
d98ecc760d
@ -191,10 +191,21 @@ class ShowfavoritesAction extends CurrentUserDesignAction
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1);
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$notice) {
|
||||
if (!empty($cur) && $cur->id == $this->user->id) {
|
||||
|
||||
// Show imported/gateway notices as well as local if
|
||||
// the user is looking at his own favorites
|
||||
|
||||
$notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1, true);
|
||||
} else {
|
||||
$notice = $this->user->favoriteNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||
NOTICES_PER_PAGE + 1, false);
|
||||
}
|
||||
|
||||
if (empty($notice)) {
|
||||
$this->serverError(_('Could not retrieve favorite notices.'));
|
||||
return;
|
||||
}
|
||||
|
@ -61,7 +61,11 @@ class TwitapifavoritesAction extends TwitterapiAction
|
||||
$since_id = (int)$this->arg('since_id', 0);
|
||||
$since = $this->arg('since');
|
||||
|
||||
$notice = $user->favoriteNotices(($page-1)*$count, $count);
|
||||
if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
|
||||
$notice = $user->favoriteNotices(($page-1)*$count, $count, true);
|
||||
} else {
|
||||
$notice = $user->favoriteNotices(($page-1)*$count, $count, false);
|
||||
}
|
||||
|
||||
switch($apidata['content-type']) {
|
||||
case 'xml':
|
||||
|
@ -75,8 +75,10 @@ class TwitapistatusesAction extends TwitterapiAction
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
$this->auth_user = $apidata['user'];
|
||||
$user = $this->get_user($apidata['api_arg'], $apidata);
|
||||
$this->auth_user = $user;
|
||||
|
||||
common_debug("auth user = " . $this->auth_user->nickname);
|
||||
|
||||
if (empty($user)) {
|
||||
$this->clientError(_('No such user!'), 404,
|
||||
@ -100,8 +102,13 @@ class TwitapistatusesAction extends TwitterapiAction
|
||||
$since_id = (int)$this->arg('since_id', 0);
|
||||
$since = $this->arg('since');
|
||||
|
||||
if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
|
||||
$notice = $user->noticeInbox(($page-1)*$count,
|
||||
$count, $since_id, $max_id, $since);
|
||||
} else {
|
||||
$notice = $user->noticesWithFriends(($page-1)*$count,
|
||||
$count, $since_id, $max_id, $since);
|
||||
}
|
||||
|
||||
switch($apidata['content-type']) {
|
||||
case 'xml':
|
||||
|
@ -37,51 +37,61 @@ class Fave extends Memcached_DataObject
|
||||
return Memcached_DataObject::pkeyGet('Fave', $kv);
|
||||
}
|
||||
|
||||
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE)
|
||||
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false)
|
||||
{
|
||||
$ids = Notice::stream(array('Fave', '_streamDirect'),
|
||||
array($user_id),
|
||||
'fave:ids_by_user:'.$user_id,
|
||||
array($user_id, $own),
|
||||
($own) ? 'fave:ids_by_user_own:'.$user_id :
|
||||
'fave:by_user:'.$user_id,
|
||||
$offset, $limit);
|
||||
return $ids;
|
||||
}
|
||||
|
||||
function _streamDirect($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||
function _streamDirect($user_id, $own, $offset, $limit, $since_id, $max_id, $since)
|
||||
{
|
||||
$fav = new Fave();
|
||||
$qry = null;
|
||||
|
||||
$fav->user_id = $user_id;
|
||||
|
||||
$fav->selectAdd();
|
||||
$fav->selectAdd('notice_id');
|
||||
if ($own) {
|
||||
$qry = 'SELECT fave.* FROM fave ';
|
||||
$qry .= 'WHERE fave.user_id = ' . $user_id . ' ';
|
||||
} else {
|
||||
$qry = 'SELECT fave.* FROM fave ';
|
||||
$qry .= 'INNER JOIN notice ON fave.notice_id = notice.id ';
|
||||
$qry .= 'WHERE fave.user_id = ' . $user_id . ' ';
|
||||
$qry .= 'AND notice.is_local != ' . NOTICE_GATEWAY . ' ';
|
||||
}
|
||||
|
||||
if ($since_id != 0) {
|
||||
$fav->whereAdd('notice_id > ' . $since_id);
|
||||
$qry .= 'AND notice_id > ' . $since_id . ' ';
|
||||
}
|
||||
|
||||
if ($max_id != 0) {
|
||||
$fav->whereAdd('notice_id <= ' . $max_id);
|
||||
$qry .= 'AND notice_id <= ' . $max_id . ' ';
|
||||
}
|
||||
|
||||
if (!is_null($since)) {
|
||||
$fav->whereAdd('modified > \'' . date('Y-m-d H:i:s', $since) . '\'');
|
||||
$qry .= 'AND modified > \'' . date('Y-m-d H:i:s', $since) . '\' ';
|
||||
}
|
||||
|
||||
// NOTE: we sort by fave time, not by notice time!
|
||||
|
||||
$fav->orderBy('modified DESC');
|
||||
$qry .= 'ORDER BY modified DESC ';
|
||||
|
||||
if (!is_null($offset)) {
|
||||
$fav->limit($offset, $limit);
|
||||
$qry .= "LIMIT $offset, $limit";
|
||||
}
|
||||
|
||||
$fav->query($qry);
|
||||
|
||||
$ids = array();
|
||||
|
||||
if ($fav->find()) {
|
||||
while ($fav->fetch()) {
|
||||
$ids[] = $fav->notice_id;
|
||||
}
|
||||
}
|
||||
|
||||
$fav->free();
|
||||
unset($fav);
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
@ -471,8 +471,10 @@ class Notice extends Memcached_DataObject
|
||||
if ($fave->find()) {
|
||||
while ($fave->fetch()) {
|
||||
$cache->delete(common_cache_key('fave:ids_by_user:'.$fave->user_id));
|
||||
$cache->delete(common_cache_key('fave:by_user_own:'.$fave->user_id));
|
||||
if ($blowLast) {
|
||||
$cache->delete(common_cache_key('fave:ids_by_user:'.$fave->user_id.';last'));
|
||||
$cache->delete(common_cache_key('fave:by_user_own:'.$fave->user_id.';last'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,9 +424,9 @@ class User extends Memcached_DataObject
|
||||
}
|
||||
}
|
||||
|
||||
function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE)
|
||||
function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE, $own=false)
|
||||
{
|
||||
$ids = Fave::stream($this->id, $offset, $limit);
|
||||
$ids = Fave::stream($this->id, $offset, $limit, $own);
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
|
||||
|
@ -95,9 +95,9 @@ $config =
|
||||
'server' => $_server,
|
||||
'theme' => 'default',
|
||||
'design' =>
|
||||
array('backgroundcolor' => '#F0F2F5',
|
||||
array('backgroundcolor' => '#CEE1E9',
|
||||
'contentcolor' => '#FFFFFF',
|
||||
'sidebarcolor' => '#CEE1E9',
|
||||
'sidebarcolor' => '#C8D1D5',
|
||||
'textcolor' => '#000000',
|
||||
'linkcolor' => '#002E6E',
|
||||
'backgroundimage' => null,
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
body,
|
||||
a:active {
|
||||
background-color:#C3D6DF;
|
||||
background-color:#CEE1E9;
|
||||
}
|
||||
body {
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
|
||||
@ -29,7 +29,7 @@ input, textarea, select,
|
||||
border-color:#AAAAAA;
|
||||
}
|
||||
#filter_tags ul li {
|
||||
border-color:#C3D6DF;
|
||||
border-color:#DDDDDD;
|
||||
}
|
||||
|
||||
.form_settings input.form_action-primary {
|
||||
@ -40,12 +40,12 @@ input.submit,
|
||||
#form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note,
|
||||
.entity_remote_subscribe {
|
||||
background-color:#A9BF4F;
|
||||
background-color:#9BB43E;
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, select:focus,
|
||||
#form_notice.warning #notice_data-text {
|
||||
border-color:#A9BF4F;
|
||||
border-color:#9BB43E;
|
||||
box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
|
||||
-moz-box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
|
||||
-webkit-box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
|
||||
@ -71,14 +71,14 @@ color:#002E6E;
|
||||
|
||||
.notice,
|
||||
.profile {
|
||||
border-top-color:#D1D9E4;
|
||||
border-top-color:#C8D1D5;
|
||||
}
|
||||
.section .profile {
|
||||
border-top-color:#C3D6DF;
|
||||
border-top-color:#87B4C8;
|
||||
}
|
||||
|
||||
#aside_primary {
|
||||
background-color:#CEE1E9;
|
||||
background-color:#C8D1D5;
|
||||
}
|
||||
|
||||
#notice_text-count {
|
||||
@ -136,13 +136,13 @@ background-color:#EFF3DC;
|
||||
}
|
||||
|
||||
#anon_notice {
|
||||
background-color:#C3D6DF;
|
||||
background-color:#87B4C8;
|
||||
color:#FFFFFF;
|
||||
border-color:#FFFFFF;
|
||||
}
|
||||
|
||||
#showstream #anon_notice {
|
||||
background-color:#A9BF4F;
|
||||
background-color:#9BB43E;
|
||||
}
|
||||
|
||||
#export_data li a {
|
||||
@ -176,13 +176,13 @@ background-color:transparent;
|
||||
.form_group_leave input.submit
|
||||
.form_user_subscribe input.submit,
|
||||
.form_user_unsubscribe input.submit {
|
||||
background-color:#A9BF4F;
|
||||
background-color:#9BB43E;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
.form_user_unsubscribe input.submit,
|
||||
.form_group_leave input.submit,
|
||||
.form_user_authorization input.reject {
|
||||
background-color:#C3D6DF;
|
||||
background-color:#87B4C8;
|
||||
}
|
||||
|
||||
.entity_edit a {
|
||||
@ -272,7 +272,7 @@ background:transparent url(../../base/images/icons/twotone/green/news.gif) no-re
|
||||
.pagination .nav_prev a,
|
||||
.pagination .nav_next a {
|
||||
background-repeat:no-repeat;
|
||||
border-color:#D1D9E4;
|
||||
border-color:#C8D1D5;
|
||||
}
|
||||
.pagination .nav_prev a {
|
||||
background-image:url(../../base/images/icons/twotone/green/arrow-left.gif);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* IE specific styles */
|
||||
|
||||
.notice-options input.submit {
|
||||
color:#fff;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
#site_nav_local_views a {
|
||||
background-color:#ACCCDA;
|
||||
background-color:#C8D1D5;
|
||||
}
|
||||
#form_notice .form_note + label {
|
||||
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* IE specific styles */
|
||||
|
||||
.notice-options input.submit {
|
||||
color:#fff;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
#site_nav_local_views a {
|
||||
background-color:#D0DFE7;
|
||||
background-color:#D9DADB;
|
||||
}
|
||||
#form_notice .form_note + label {
|
||||
background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%;
|
||||
|
Loading…
Reference in New Issue
Block a user