1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 16:24:52 +09:00

S2S: Prepare inbox handler for Group as well

This commit is contained in:
fr33domlover 2022-09-06 17:41:09 +00:00
parent 43a1bb5ef7
commit 00a39475eb

View file

@ -43,33 +43,29 @@ module Vervis.Handler.Group
)
where
import Control.Monad.IO.Class (liftIO)
import Data.Maybe (fromMaybe)
import Data.Time.Clock (getCurrentTime)
import Database.Esqueleto hiding ((==.), (!=.), delete)
import Control.Monad.Trans.Except
import Data.Text (Text)
import Database.Persist
import Text.Blaze.Html (Html)
import Yesod.Auth (requireAuthId)
import Yesod.Core (defaultLayout, setMessage)
import Data.ByteString (ByteString)
import Yesod.Core.Content (TypedContent)
import Yesod.Core.Handler
import Yesod.Form.Functions (runFormPost)
import Yesod.Form.Types (FormResult (..))
import Yesod.Persist.Core
import qualified Database.Esqueleto as E
import Network.FedURI
import Yesod.ActivityPub
import Yesod.FedURI
import Yesod.Hashids
import qualified Web.ActivityPub as AP
import Vervis.Federation.Auth
import Vervis.FedURI
import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Group
import Vervis.Settings (widgetFile)
import Vervis.Time (showDate)
import Vervis.Recipient
import Vervis.Web.Actor
getGroupR :: KeyHashid Group -> Handler TypedContent
@ -110,8 +106,19 @@ getGroupR groupHash = do
getGroupInboxR :: KeyHashid Group -> Handler TypedContent
getGroupInboxR = getInbox GroupInboxR groupActor
postGroupInboxR :: KeyHashid Group -> Handler TypedContent
postGroupInboxR _ = error "Temporarily disabled"
postGroupInboxR :: KeyHashid Group -> Handler ()
postGroupInboxR recipGroupHash =
postInbox $ handleRobotInbox (LocalActorGroup recipGroupHash) handle
where
handle
:: RemoteAuthor
-> Maybe (RecipientRoutes, ByteString)
-> LocalURI
-> AP.SpecificActivity URIMode
-> ExceptT Text Handler (Text, Maybe (ExceptT Text Worker Text))
handle _author _mfwd _luActivity specific =
case specific of
_ -> return ("Unsupported activity type for groups", Nothing)
getGroupOutboxR :: KeyHashid Group -> Handler TypedContent
getGroupOutboxR = getOutbox GroupOutboxR groupActor