forked from GNUsocial/gnu-social
Only show twitter msgs in your own inbox
This commit is contained in:
parent
b761cfd409
commit
3f54840b51
@ -98,7 +98,13 @@ class AllAction extends ProfileAction
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!empty($cur) && $cur->id == $this->user->id) {
|
||||
$notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
} else {
|
||||
$notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
}
|
||||
|
||||
$nl = new NoticeList($notice, $this);
|
||||
|
||||
|
@ -81,6 +81,14 @@ class AllrssAction extends Rss10Action
|
||||
*/
|
||||
function getNotices($limit=0)
|
||||
{
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!empty($cur) && $cur->id == $user->id) {
|
||||
$notice = $this->user->noticeInbox(0, $limit);
|
||||
} else {
|
||||
$notice = $this->user->noticesWithFriends(0, $limit);
|
||||
}
|
||||
|
||||
$user = $this->user;
|
||||
$notice = $user->noticesWithFriends(0, $limit);
|
||||
$notices = array();
|
||||
|
@ -21,7 +21,6 @@ if (!defined('LACONICA')) { exit(1); }
|
||||
|
||||
require_once INSTALLDIR.'/lib/facebookaction.php';
|
||||
|
||||
|
||||
class FacebookhomeAction extends FacebookAction
|
||||
{
|
||||
|
||||
@ -142,7 +141,6 @@ class FacebookhomeAction extends FacebookAction
|
||||
FACEBOOK_PROMPTED_UPDATE_PREF, 'false');
|
||||
}
|
||||
|
||||
|
||||
function showNoticeForm()
|
||||
{
|
||||
$post_action = "$this->app_uri/index.php";
|
||||
@ -163,8 +161,7 @@ class FacebookhomeAction extends FacebookAction
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$notice = $this->user->noticesWithFriends(($this->page-1) *
|
||||
NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
$notice = $this->user->noticeInbox(($this->page-1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
|
||||
$nl = new NoticeList($notice, $this);
|
||||
|
||||
@ -275,5 +272,4 @@ class FacebookhomeAction extends FacebookAction
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -406,8 +406,10 @@ class Notice extends Memcached_DataObject
|
||||
|
||||
while ($user->fetch()) {
|
||||
$cache->delete(common_cache_key('notice_inbox:by_user:'.$user->id));
|
||||
$cache->delete(common_cache_key('notice_inbox:by_user_own:'.$user->id));
|
||||
if ($blowLast) {
|
||||
$cache->delete(common_cache_key('notice_inbox:by_user:'.$user->id.';last'));
|
||||
$cache->delete(common_cache_key('notice_inbox:by_user_own:'.$user->id.';last'));
|
||||
}
|
||||
}
|
||||
$user->free();
|
||||
|
@ -47,20 +47,25 @@ class Notice_inbox extends Memcached_DataObject
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function stream($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||
function stream($user_id, $offset, $limit, $since_id, $max_id, $since, $own=false)
|
||||
{
|
||||
return Notice::stream(array('Notice_inbox', '_streamDirect'),
|
||||
array($user_id),
|
||||
'notice_inbox:by_user:'.$user_id,
|
||||
array($user_id, $own),
|
||||
($own) ? 'notice_inbox:by_user:'.$user_id :
|
||||
'notice_inbox:by_user_own:'.$user_id,
|
||||
$offset, $limit, $since_id, $max_id, $since);
|
||||
}
|
||||
|
||||
function _streamDirect($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||
function _streamDirect($user_id, $own, $offset, $limit, $since_id, $max_id, $since)
|
||||
{
|
||||
$inbox = new Notice_inbox();
|
||||
|
||||
$inbox->user_id = $user_id;
|
||||
|
||||
if (!$own) {
|
||||
$inbox->whereAdd('source != ' . NOTICE_INBOX_SOURCE_GATEWAY);
|
||||
}
|
||||
|
||||
if ($since_id != 0) {
|
||||
$inbox->whereAdd('notice_id > ' . $since_id);
|
||||
}
|
||||
|
@ -437,6 +437,33 @@ class User extends Memcached_DataObject
|
||||
// Complicated code, depending on whether we support inboxes yet
|
||||
// XXX: make this go away when inboxes become mandatory
|
||||
|
||||
if ($enabled === false ||
|
||||
($enabled == 'transitional' && $this->inboxed == 0)) {
|
||||
$qry =
|
||||
'SELECT notice.* ' .
|
||||
'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' .
|
||||
'WHERE subscription.subscriber = %d ' .
|
||||
'AND notice.is_local != ' . NOTICE_GATEWAY;
|
||||
return Notice::getStream(sprintf($qry, $this->id),
|
||||
'user:notices_with_friends:' . $this->id,
|
||||
$offset, $limit, $since_id, $before_id,
|
||||
$order, $since);
|
||||
} else if ($enabled === true ||
|
||||
($enabled == 'transitional' && $this->inboxed == 1)) {
|
||||
|
||||
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, false);
|
||||
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
}
|
||||
|
||||
function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
||||
{
|
||||
$enabled = common_config('inboxes', 'enabled');
|
||||
|
||||
// Complicated code, depending on whether we support inboxes yet
|
||||
// XXX: make this go away when inboxes become mandatory
|
||||
|
||||
if ($enabled === false ||
|
||||
($enabled == 'transitional' && $this->inboxed == 0)) {
|
||||
$qry =
|
||||
@ -450,7 +477,7 @@ class User extends Memcached_DataObject
|
||||
} else if ($enabled === true ||
|
||||
($enabled == 'transitional' && $this->inboxed == 1)) {
|
||||
|
||||
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since);
|
||||
$ids = Notice_inbox::stream($this->id, $offset, $limit, $since_id, $before_id, $since, true);
|
||||
|
||||
return Notice::getStreamByIds($ids);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user