mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 01:34:52 +09:00
Don't list non-public follows in follower collections
This commit is contained in:
parent
544ebae3fd
commit
3a68a3e7e6
1 changed files with 15 additions and 8 deletions
|
@ -776,30 +776,37 @@ pushCommitsC (eperson, sharer) summary push shrRepo rpRepo = runExceptT $ do
|
||||||
getFollowersCollection
|
getFollowersCollection
|
||||||
:: Route App -> AppDB FollowerSetId -> Handler TypedContent
|
:: Route App -> AppDB FollowerSetId -> Handler TypedContent
|
||||||
getFollowersCollection here getFsid = do
|
getFollowersCollection here getFsid = do
|
||||||
(locals, remotes) <- runDB $ do
|
(locals, remotes, l, r) <- runDB $ do
|
||||||
fsid <- getFsid
|
fsid <- getFsid
|
||||||
(,) <$> do pids <- map (followPerson . entityVal) <$>
|
(,,,) <$> do pids <-
|
||||||
selectList [FollowTarget ==. fsid] []
|
map (followPerson . entityVal) <$>
|
||||||
sids <-
|
selectList
|
||||||
|
[FollowTarget ==. fsid, FollowPublic ==. True]
|
||||||
|
[]
|
||||||
|
sids <-
|
||||||
map (personIdent . entityVal) <$>
|
map (personIdent . entityVal) <$>
|
||||||
selectList [PersonId <-. pids] []
|
selectList [PersonId <-. pids] []
|
||||||
map (sharerIdent . entityVal) <$>
|
map (sharerIdent . entityVal) <$>
|
||||||
selectList [SharerId <-. sids] []
|
selectList [SharerId <-. sids] []
|
||||||
<*> do E.select $ E.from $ \ (rf `E.InnerJoin` ra `E.InnerJoin` i) -> do
|
<*> do E.select $ E.from $ \ (rf `E.InnerJoin` ra `E.InnerJoin` i) -> do
|
||||||
E.on $ ra E.^. RemoteActorInstance E.==. i E.^. InstanceId
|
E.on $ ra E.^. RemoteActorInstance E.==. i E.^. InstanceId
|
||||||
E.on $ rf E.^. RemoteFollowActor E.==. ra E.^. RemoteActorId
|
E.on $ rf E.^. RemoteFollowActor E.==. ra E.^. RemoteActorId
|
||||||
E.where_ $ rf E.^. RemoteFollowTarget E.==. E.val fsid
|
E.where_
|
||||||
|
$ rf E.^. RemoteFollowTarget E.==. E.val fsid
|
||||||
|
E.&&. rf E.^. RemoteFollowPublic E.==. E.val True
|
||||||
return
|
return
|
||||||
( i E.^. InstanceHost
|
( i E.^. InstanceHost
|
||||||
, ra E.^. RemoteActorIdent
|
, ra E.^. RemoteActorIdent
|
||||||
)
|
)
|
||||||
|
<*> count [FollowTarget ==. fsid]
|
||||||
|
<*> count [RemoteFollowTarget ==. fsid]
|
||||||
|
|
||||||
encodeRouteLocal <- getEncodeRouteLocal
|
encodeRouteLocal <- getEncodeRouteLocal
|
||||||
encodeRouteHome <- getEncodeRouteHome
|
encodeRouteHome <- getEncodeRouteHome
|
||||||
let followersAP = Collection
|
let followersAP = Collection
|
||||||
{ collectionId = encodeRouteLocal here
|
{ collectionId = encodeRouteLocal here
|
||||||
, collectionType = CollectionTypeUnordered
|
, collectionType = CollectionTypeUnordered
|
||||||
, collectionTotalItems = Just $ length locals + length remotes
|
, collectionTotalItems = Just $ l + r
|
||||||
, collectionCurrent = Nothing
|
, collectionCurrent = Nothing
|
||||||
, collectionFirst = Nothing
|
, collectionFirst = Nothing
|
||||||
, collectionLast = Nothing
|
, collectionLast = Nothing
|
||||||
|
|
Loading…
Reference in a new issue