From 1f7b24d0f2b771c66011f190f830629c143f3d97 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 9 Oct 2020 16:13:08 +0200 Subject: [PATCH] show all activity when viewing your own profile, not just public activity some more fine grained checks should be added later but this at least prevents 'you haven't tooted yet' from showing when you have tooted Signed-off-by: Robin Appelman --- lib/Db/SocialLimitsQueryBuilder.php | 4 +++- lib/Db/StreamRequest.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Db/SocialLimitsQueryBuilder.php b/lib/Db/SocialLimitsQueryBuilder.php index d3249fc7..d3a4ff47 100644 --- a/lib/Db/SocialLimitsQueryBuilder.php +++ b/lib/Db/SocialLimitsQueryBuilder.php @@ -408,7 +408,9 @@ class SocialLimitsQueryBuilder extends SocialCrossQueryBuilder { $andX = $expr->andX(); $andX->add($expr->eq($alias . '.stream_id', $this->getDefaultSelectAlias() . '.id_prim')); - $andX->add($this->exprLimitToDBField('actor_id', $this->prim($actorId), true, true, $alias)); + if ($actorId) { + $andX->add($this->exprLimitToDBField('actor_id', $this->prim($actorId), true, true, $alias)); + } $andX->add($this->exprLimitToDBField('type', $type, true, true, $alias)); if ($subType !== '') { diff --git a/lib/Db/StreamRequest.php b/lib/Db/StreamRequest.php index 1e40fbdb..564f7bc5 100644 --- a/lib/Db/StreamRequest.php +++ b/lib/Db/StreamRequest.php @@ -489,7 +489,8 @@ class StreamRequest extends StreamRequestBuilder { $qb->selectDestFollowing('sd', ''); $qb->innerJoinSteamDest('recipient', 'id_prim', 'sd', 's'); - $qb->limitToDest(ACore::CONTEXT_PUBLIC, 'recipient', '', 'sd'); + $accountIsViewer = ($this->viewer) ? $this->viewer->getId() === $actorId : false; + $qb->limitToDest($accountIsViewer ? '' : ACore::CONTEXT_PUBLIC, 'recipient', '', 'sd'); $qb->linkToCacheActors('ca', 's.attributed_to_prim'); $qb->leftJoinStreamAction();