S2S: Prepare inbox handler for Group as well
This commit is contained in:
parent
43a1bb5ef7
commit
00a39475eb
1 changed files with 20 additions and 13 deletions
|
@ -43,33 +43,29 @@ module Vervis.Handler.Group
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.Trans.Except
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Text (Text)
|
||||||
import Data.Time.Clock (getCurrentTime)
|
|
||||||
import Database.Esqueleto hiding ((==.), (!=.), delete)
|
|
||||||
import Database.Persist
|
import Database.Persist
|
||||||
import Text.Blaze.Html (Html)
|
import Data.ByteString (ByteString)
|
||||||
import Yesod.Auth (requireAuthId)
|
|
||||||
import Yesod.Core (defaultLayout, setMessage)
|
|
||||||
import Yesod.Core.Content (TypedContent)
|
import Yesod.Core.Content (TypedContent)
|
||||||
import Yesod.Core.Handler
|
import Yesod.Core.Handler
|
||||||
import Yesod.Form.Functions (runFormPost)
|
|
||||||
import Yesod.Form.Types (FormResult (..))
|
|
||||||
import Yesod.Persist.Core
|
import Yesod.Persist.Core
|
||||||
|
|
||||||
import qualified Database.Esqueleto as E
|
import qualified Database.Esqueleto as E
|
||||||
|
|
||||||
|
import Network.FedURI
|
||||||
import Yesod.ActivityPub
|
import Yesod.ActivityPub
|
||||||
import Yesod.FedURI
|
import Yesod.FedURI
|
||||||
import Yesod.Hashids
|
import Yesod.Hashids
|
||||||
|
|
||||||
import qualified Web.ActivityPub as AP
|
import qualified Web.ActivityPub as AP
|
||||||
|
|
||||||
|
import Vervis.Federation.Auth
|
||||||
|
import Vervis.FedURI
|
||||||
import Vervis.Foundation
|
import Vervis.Foundation
|
||||||
import Vervis.Model
|
import Vervis.Model
|
||||||
import Vervis.Model.Group
|
import Vervis.Model.Group
|
||||||
import Vervis.Settings (widgetFile)
|
import Vervis.Recipient
|
||||||
import Vervis.Time (showDate)
|
|
||||||
import Vervis.Web.Actor
|
import Vervis.Web.Actor
|
||||||
|
|
||||||
getGroupR :: KeyHashid Group -> Handler TypedContent
|
getGroupR :: KeyHashid Group -> Handler TypedContent
|
||||||
|
@ -110,8 +106,19 @@ getGroupR groupHash = do
|
||||||
getGroupInboxR :: KeyHashid Group -> Handler TypedContent
|
getGroupInboxR :: KeyHashid Group -> Handler TypedContent
|
||||||
getGroupInboxR = getInbox GroupInboxR groupActor
|
getGroupInboxR = getInbox GroupInboxR groupActor
|
||||||
|
|
||||||
postGroupInboxR :: KeyHashid Group -> Handler TypedContent
|
postGroupInboxR :: KeyHashid Group -> Handler ()
|
||||||
postGroupInboxR _ = error "Temporarily disabled"
|
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 :: KeyHashid Group -> Handler TypedContent
|
||||||
getGroupOutboxR = getOutbox GroupOutboxR groupActor
|
getGroupOutboxR = getOutbox GroupOutboxR groupActor
|
||||||
|
|
Loading…
Reference in a new issue