Rename OutboxR to SharerOutboxR, because projects will have outboxes too

This commit is contained in:
fr33domlover 2019-06-16 14:58:00 +00:00
parent 8e01f9b416
commit 5aaf2ba8a9
7 changed files with 24 additions and 22 deletions

View file

@ -54,8 +54,8 @@
/s/#ShrIdent SharerR GET /s/#ShrIdent SharerR GET
/s/#ShrIdent/inbox SharerInboxR GET POST /s/#ShrIdent/inbox SharerInboxR GET POST
/s/#ShrIdent/notifications NotificationsR GET POST /s/#ShrIdent/notifications NotificationsR GET POST
/s/#ShrIdent/outbox OutboxR GET POST /s/#ShrIdent/outbox SharerOutboxR GET POST
/s/#ShrIdent/outbox/#OutboxItemKeyHashid OutboxItemR GET /s/#ShrIdent/outbox/#OutboxItemKeyHashid SharerOutboxItemR GET
/p PeopleR GET /p PeopleR GET

View file

@ -475,7 +475,7 @@ createNoteC host (Note mluNote luAttrib aud muParent muContext mpublished source
route2local <- getEncodeRouteLocal route2local <- getEncodeRouteLocal
obihid <- encodeKeyHashid obiid obihid <- encodeKeyHashid obiid
lmhid <- encodeKeyHashid lmid lmhid <- encodeKeyHashid lmid
let luAct = route2local $ OutboxItemR shrUser obihid let luAct = route2local $ SharerOutboxItemR shrUser obihid
luNote = route2local $ MessageR shrUser lmhid luNote = route2local $ MessageR shrUser lmhid
doc = activity luAct luNote doc = activity luAct luNote
update obiid [OutboxItemActivity =. PersistJSON doc] update obiid [OutboxItemActivity =. PersistJSON doc]

View file

@ -416,7 +416,7 @@ handleSharerInbox _now shrRecip (Left pidAuthor) _raw activity = do
Nothing -> throwE "Local activity: Not a valid route" Nothing -> throwE "Local activity: Not a valid route"
Just r -> return r Just r -> return r
case route of case route of
OutboxItemR shr obikhid -> SharerOutboxItemR shr obikhid ->
(shr,) <$> decodeKeyHashidE obikhid "Local activity: ID is invalid hashid" (shr,) <$> decodeKeyHashidE obikhid "Local activity: ID is invalid hashid"
_ -> throwE "Local activity: Not an activity route" _ -> throwE "Local activity: Not an activity route"
runDBExcept $ do runDBExcept $ do

View file

@ -284,7 +284,7 @@ instance Yesod App where
(SharerInboxR shr , False) -> person shr (SharerInboxR shr , False) -> person shr
(NotificationsR shr , _ ) -> person shr (NotificationsR shr , _ ) -> person shr
(OutboxR shr , True) -> person shr (SharerOutboxR shr , True) -> person shr
(GroupsR , True) -> personAny (GroupsR , True) -> personAny
(GroupNewR , _ ) -> personAny (GroupNewR , _ ) -> personAny
@ -720,9 +720,9 @@ instance YesodBreadcrumbs App where
PublishR -> ("Publish", Just HomeR) PublishR -> ("Publish", Just HomeR)
InboxR -> ("Inbox", Just HomeR) InboxR -> ("Inbox", Just HomeR)
OutboxR shr -> ("Outbox", Just $ SharerR shr) SharerOutboxR shr -> ("Outbox", Just $ SharerR shr)
OutboxItemR shr hid -> ( "#" <> keyHashidText hid SharerOutboxItemR shr hid -> ( "#" <> keyHashidText hid
, Just $ OutboxR shr , Just $ SharerOutboxR shr
) )
ActorKey1R -> ("Actor Key 1", Nothing) ActorKey1R -> ("Actor Key 1", Nothing)
ActorKey2R -> ("Actor Key 2", Nothing) ActorKey2R -> ("Actor Key 2", Nothing)

View file

@ -20,9 +20,9 @@ module Vervis.Handler.Inbox
, postSharerInboxR , postSharerInboxR
, postProjectInboxR , postProjectInboxR
, getPublishR , getPublishR
, getOutboxR , getSharerOutboxR
, getOutboxItemR , getSharerOutboxItemR
, postOutboxR , postSharerOutboxR
, getActorKey1R , getActorKey1R
, getActorKey2R , getActorKey2R
, getNotificationsR , getNotificationsR
@ -349,7 +349,7 @@ activityWidget shr widget enctype =
This is a federation test page. Provide a recepient actor URI and This is a federation test page. Provide a recepient actor URI and
message text, and a Create activity creating a new Note will be sent message text, and a Create activity creating a new Note will be sent
to the destination server. to the destination server.
<form method=POST action=@{OutboxR shr} enctype=#{enctype}> <form method=POST action=@{SharerOutboxR shr} enctype=#{enctype}>
^{widget} ^{widget}
<input type=submit> <input type=submit>
|] |]
@ -366,8 +366,8 @@ getPublishR = do
((_result, widget), enctype) <- runFormPost activityForm ((_result, widget), enctype) <- runFormPost activityForm
defaultLayout $ activityWidget shr widget enctype defaultLayout $ activityWidget shr widget enctype
getOutboxR :: ShrIdent -> Handler TypedContent getSharerOutboxR :: ShrIdent -> Handler TypedContent
getOutboxR shr = do getSharerOutboxR shr = do
(total, pages, mpage) <- runDB $ do (total, pages, mpage) <- runDB $ do
sid <- getKeyBy404 $ UniqueSharer shr sid <- getKeyBy404 $ UniqueSharer shr
p <- getValBy404 $ UniquePersonIdent sid p <- getValBy404 $ UniquePersonIdent sid
@ -375,7 +375,7 @@ getOutboxR shr = do
countAllItems = count [OutboxItemOutbox ==. obid] countAllItems = count [OutboxItemOutbox ==. obid]
selectItems off lim = selectList [OutboxItemOutbox ==. obid] [Desc OutboxItemId, OffsetBy off, LimitTo lim] selectItems off lim = selectList [OutboxItemOutbox ==. obid] [Desc OutboxItemId, OffsetBy off, LimitTo lim]
getPageAndNavCount countAllItems selectItems getPageAndNavCount countAllItems selectItems
let here = OutboxR shr let here = SharerOutboxR shr
encodeRouteLocal <- getEncodeRouteLocal encodeRouteLocal <- getEncodeRouteLocal
encodeRoutePageLocal <- getEncodeRoutePageLocal encodeRoutePageLocal <- getEncodeRoutePageLocal
let pageUrl = encodeRoutePageLocal here let pageUrl = encodeRoutePageLocal here
@ -424,8 +424,8 @@ getOutboxR shr = do
diffUTCTime now diffUTCTime now
defaultLayout $(widgetFile "person/outbox") defaultLayout $(widgetFile "person/outbox")
getOutboxItemR :: ShrIdent -> KeyHashid OutboxItem -> Handler TypedContent getSharerOutboxItemR :: ShrIdent -> KeyHashid OutboxItem -> Handler TypedContent
getOutboxItemR shr obikhid = do getSharerOutboxItemR shr obikhid = do
obiid <- decodeKeyHashid404 obikhid obiid <- decodeKeyHashid404 obikhid
Doc h act <- runDB $ do Doc h act <- runDB $ do
sid <- getKeyBy404 $ UniqueSharer shr sid <- getKeyBy404 $ UniqueSharer shr
@ -433,11 +433,11 @@ getOutboxItemR shr obikhid = do
obi <- get404 obiid obi <- get404 obiid
unless (outboxItemOutbox obi == personOutbox p) notFound unless (outboxItemOutbox obi == personOutbox p) notFound
return $ persistJSONValue $ outboxItemActivity obi return $ persistJSONValue $ outboxItemActivity obi
let here = OutboxItemR shr obikhid let here = SharerOutboxItemR shr obikhid
provideHtmlAndAP' h act $ redirect (here, [("prettyjson", "true")]) provideHtmlAndAP' h act $ redirect (here, [("prettyjson", "true")])
postOutboxR :: ShrIdent -> Handler Html postSharerOutboxR :: ShrIdent -> Handler Html
postOutboxR shrAuthor = do postSharerOutboxR shrAuthor = do
federation <- getsYesod $ appFederation . appSettings federation <- getsYesod $ appFederation . appSettings
unless federation badMethod unless federation badMethod
((result, widget), enctype) <- runFormPost activityForm ((result, widget), enctype) <- runFormPost activityForm

View file

@ -141,7 +141,7 @@ getPerson shr sharer person = do
, actorName = sharerName sharer , actorName = sharerName sharer
, actorSummary = Nothing , actorSummary = Nothing
, actorInbox = route2local $ SharerInboxR shr , actorInbox = route2local $ SharerInboxR shr
, actorOutbox = Just $ route2local $ OutboxR shr , actorOutbox = Just $ route2local $ SharerOutboxR shr
, actorFollowers = Nothing , actorFollowers = Nothing
, actorPublicKeys = , actorPublicKeys =
[ Left $ route2local ActorKey1R [ Left $ route2local ActorKey1R

View file

@ -769,7 +769,9 @@ changes hLocal ctx =
} }
obkhidNew <- obkhidNew <-
encodeKeyHashid $ E.toSqlKey $ E.fromSqlKey obidNew encodeKeyHashid $ E.toSqlKey $ E.fromSqlKey obidNew
let luAct = encodeRouteLocal $ OutboxItemR shrAuthor obkhidNew let luAct =
encodeRouteLocal $
SharerOutboxItemR shrAuthor obkhidNew
act = doc luAct act = doc luAct
update obidNew [OutboxItem20190612Activity =. PersistJSON act] update obidNew [OutboxItem20190612Activity =. PersistJSON act]
update talid [TicketAuthorLocal20190612Offer =. obidNew] update talid [TicketAuthorLocal20190612Offer =. obidNew]