From 1f7b24d0f2b771c66011f190f830629c143f3d97 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 9 Oct 2020 16:13:08 +0200 Subject: 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(-) (limited to 'lib') 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(); -- cgit v1.2.3 From 931c1d8ba8f5c0797eba37f2fef6643389aa6059 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sun, 11 Oct 2020 23:34:31 -0100 Subject: using hasViewer() Signed-off-by: Maxence Lange --- lib/Db/StreamRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Db/StreamRequest.php b/lib/Db/StreamRequest.php index 564f7bc5..f9d86249 100644 --- a/lib/Db/StreamRequest.php +++ b/lib/Db/StreamRequest.php @@ -489,7 +489,7 @@ class StreamRequest extends StreamRequestBuilder { $qb->selectDestFollowing('sd', ''); $qb->innerJoinSteamDest('recipient', 'id_prim', 'sd', 's'); - $accountIsViewer = ($this->viewer) ? $this->viewer->getId() === $actorId : false; + $accountIsViewer = ($qb->hasViewer()) ? ($qb->getViewer()->getId() === $actorId) : false; $qb->limitToDest($accountIsViewer ? '' : ACore::CONTEXT_PUBLIC, 'recipient', '', 'sd'); $qb->linkToCacheActors('ca', 's.attributed_to_prim'); -- cgit v1.2.3