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/inbox SharerInboxR GET POST
/s/#ShrIdent/notifications NotificationsR GET POST
/s/#ShrIdent/outbox OutboxR GET POST
/s/#ShrIdent/outbox/#OutboxItemKeyHashid OutboxItemR GET
/s/#ShrIdent/outbox SharerOutboxR GET POST
/s/#ShrIdent/outbox/#OutboxItemKeyHashid SharerOutboxItemR GET
/p PeopleR GET

View file

@ -475,7 +475,7 @@ createNoteC host (Note mluNote luAttrib aud muParent muContext mpublished source
route2local <- getEncodeRouteLocal
obihid <- encodeKeyHashid obiid
lmhid <- encodeKeyHashid lmid
let luAct = route2local $ OutboxItemR shrUser obihid
let luAct = route2local $ SharerOutboxItemR shrUser obihid
luNote = route2local $ MessageR shrUser lmhid
doc = activity luAct luNote
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"
Just r -> return r
case route of
OutboxItemR shr obikhid ->
SharerOutboxItemR shr obikhid ->
(shr,) <$> decodeKeyHashidE obikhid "Local activity: ID is invalid hashid"
_ -> throwE "Local activity: Not an activity route"
runDBExcept $ do

View file

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

View file

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

View file

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

View file

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