mirror of
https://code.naskya.net/repos/ndqEd
synced 2025-01-10 10:46:45 +09:00
Person: Implement (the quite trivial) Join handler
This commit is contained in:
parent
4d8e5de8b8
commit
b759b87d0f
1 changed files with 31 additions and 0 deletions
|
@ -362,6 +362,35 @@ personInvite now recipPersonID author body mfwd luInvite invite = do
|
||||||
"I'm the target; Inserted to inbox; \
|
"I'm the target; Inserted to inbox; \
|
||||||
\Forwarded to followers if addressed"
|
\Forwarded to followers if addressed"
|
||||||
|
|
||||||
|
-- Meaning: Someone asked to join a resource
|
||||||
|
-- Behavior: Insert to my inbox
|
||||||
|
personJoin
|
||||||
|
:: UTCTime
|
||||||
|
-> PersonId
|
||||||
|
-> RemoteAuthor
|
||||||
|
-> ActivityBody
|
||||||
|
-> Maybe (RecipientRoutes, ByteString)
|
||||||
|
-> LocalURI
|
||||||
|
-> AP.Join URIMode
|
||||||
|
-> ActE (Text, Act (), Next)
|
||||||
|
personJoin now recipPersonID author body mfwd luJoin join = do
|
||||||
|
|
||||||
|
-- Check input
|
||||||
|
_resource <- parseJoin join
|
||||||
|
|
||||||
|
maybeJoinID <- lift $ withDB $ do
|
||||||
|
|
||||||
|
-- Grab recipient person from DB
|
||||||
|
(_personRecip, actorRecip) <- do
|
||||||
|
p <- getJust recipPersonID
|
||||||
|
(p,) <$> getJust (personActor p)
|
||||||
|
|
||||||
|
insertToInbox now author body (actorInbox actorRecip) luJoin True
|
||||||
|
|
||||||
|
case maybeJoinID of
|
||||||
|
Nothing -> done "I already have this activity in my inbox"
|
||||||
|
Just _joinID -> done "Inserted to my inbox"
|
||||||
|
|
||||||
-- Meaning: A remote actor published a Grant
|
-- Meaning: A remote actor published a Grant
|
||||||
-- Behavior:
|
-- Behavior:
|
||||||
-- * Insert to my inbox
|
-- * Insert to my inbox
|
||||||
|
@ -469,6 +498,8 @@ personBehavior now personID (Right (VerseRemote author body mfwd luActivity)) =
|
||||||
personGrant now personID author body mfwd luActivity grant
|
personGrant now personID author body mfwd luActivity grant
|
||||||
AP.InviteActivity invite ->
|
AP.InviteActivity invite ->
|
||||||
personInvite now personID author body mfwd luActivity invite
|
personInvite now personID author body mfwd luActivity invite
|
||||||
|
AP.JoinActivity join ->
|
||||||
|
personJoin now personID author body mfwd luActivity join
|
||||||
{-
|
{-
|
||||||
AP.UndoActivity undo ->
|
AP.UndoActivity undo ->
|
||||||
(,Nothing) <$> personUndoA now personID author body mfwd luActivity undo
|
(,Nothing) <$> personUndoA now personID author body mfwd luActivity undo
|
||||||
|
|
Loading…
Reference in a new issue