From ee26ef7b828746d5d3edd4963ff958267c4f6da0 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 26 Sep 2022 14:20:21 +0000 Subject: [PATCH] UI: Actor outbox view: Render URI from route instead of parsing JSON for @id --- src/Vervis/Handler/Deck.hs | 2 +- src/Vervis/Handler/Group.hs | 2 +- src/Vervis/Handler/Loom.hs | 2 +- src/Vervis/Handler/Person.hs | 2 +- src/Vervis/Handler/Repo.hs | 2 +- src/Vervis/Web/Actor.hs | 5 +++-- templates/person/outbox.hamlet | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Vervis/Handler/Deck.hs b/src/Vervis/Handler/Deck.hs index 34d1098..588bc73 100644 --- a/src/Vervis/Handler/Deck.hs +++ b/src/Vervis/Handler/Deck.hs @@ -206,7 +206,7 @@ postDeckInboxR recipDeckHash = _ -> return ("Unsupported activity type for decks", Nothing) getDeckOutboxR :: KeyHashid Deck -> Handler TypedContent -getDeckOutboxR = getOutbox DeckOutboxR deckActor +getDeckOutboxR = getOutbox DeckOutboxR DeckOutboxItemR deckActor getDeckOutboxItemR :: KeyHashid Deck -> KeyHashid OutboxItem -> Handler TypedContent diff --git a/src/Vervis/Handler/Group.hs b/src/Vervis/Handler/Group.hs index ccbe4c8..00bbd2e 100644 --- a/src/Vervis/Handler/Group.hs +++ b/src/Vervis/Handler/Group.hs @@ -120,7 +120,7 @@ postGroupInboxR recipGroupHash = _ -> return ("Unsupported activity type for groups", Nothing) getGroupOutboxR :: KeyHashid Group -> Handler TypedContent -getGroupOutboxR = getOutbox GroupOutboxR groupActor +getGroupOutboxR = getOutbox GroupOutboxR GroupOutboxItemR groupActor getGroupOutboxItemR :: KeyHashid Group -> KeyHashid OutboxItem -> Handler TypedContent diff --git a/src/Vervis/Handler/Loom.hs b/src/Vervis/Handler/Loom.hs index 560cd48..d627ef6 100644 --- a/src/Vervis/Handler/Loom.hs +++ b/src/Vervis/Handler/Loom.hs @@ -154,7 +154,7 @@ postLoomInboxR recipLoomHash = _ -> return ("Unsupported activity type for looms", Nothing) getLoomOutboxR :: KeyHashid Loom -> Handler TypedContent -getLoomOutboxR = getOutbox LoomOutboxR loomActor +getLoomOutboxR = getOutbox LoomOutboxR LoomOutboxItemR loomActor getLoomOutboxItemR :: KeyHashid Loom -> KeyHashid OutboxItem -> Handler TypedContent diff --git a/src/Vervis/Handler/Person.hs b/src/Vervis/Handler/Person.hs index ca40d4b..495e699 100644 --- a/src/Vervis/Handler/Person.hs +++ b/src/Vervis/Handler/Person.hs @@ -230,7 +230,7 @@ postPersonInboxR recipPersonHash = postInbox handle _ -> return ("Unsupported activity type for Person", Nothing) getPersonOutboxR :: KeyHashid Person -> Handler TypedContent -getPersonOutboxR = getOutbox PersonOutboxR personActor +getPersonOutboxR = getOutbox PersonOutboxR PersonOutboxItemR personActor postPersonOutboxR :: KeyHashid Person -> Handler TypedContent postPersonOutboxR personHash = do diff --git a/src/Vervis/Handler/Repo.hs b/src/Vervis/Handler/Repo.hs index 39b6592..a00caf2 100644 --- a/src/Vervis/Handler/Repo.hs +++ b/src/Vervis/Handler/Repo.hs @@ -277,7 +277,7 @@ postRepoInboxR recipRepoHash = _ -> return ("Unsupported activity type for repos", Nothing) getRepoOutboxR :: KeyHashid Repo -> Handler TypedContent -getRepoOutboxR = getOutbox RepoOutboxR repoActor +getRepoOutboxR = getOutbox RepoOutboxR RepoOutboxItemR repoActor getRepoOutboxItemR :: KeyHashid Repo -> KeyHashid OutboxItem -> Handler TypedContent diff --git a/src/Vervis/Web/Actor.hs b/src/Vervis/Web/Actor.hs index e2306a1..b6e7950 100644 --- a/src/Vervis/Web/Actor.hs +++ b/src/Vervis/Web/Actor.hs @@ -276,11 +276,11 @@ postInbox handler = do then V.init vec' else vec' -getOutbox here actor hash = do +getOutbox here itemRoute grabActorID hash = do key <- decodeKeyHashid404 hash (total, pages, mpage) <- runDB $ do outboxID <- do - actorID <- actor <$> get404 key + actorID <- grabActorID <$> get404 key actorOutbox <$> getJust actorID let countAllItems = count [OutboxItemOutbox ==. outboxID] selectItems off lim = selectList [OutboxItemOutbox ==. outboxID] [Desc OutboxItemId, OffsetBy off, LimitTo lim] @@ -328,6 +328,7 @@ getOutbox here actor hash = do provideRep $ do let pageNav = navWidget navModel showTime <- getShowTime + hashItem <- getEncodeKeyHashid defaultLayout $(widgetFile "person/outbox") getOutboxItem here actor topicHash itemHash = do diff --git a/templates/person/outbox.hamlet b/templates/person/outbox.hamlet index c027649..8f48979 100644 --- a/templates/person/outbox.hamlet +++ b/templates/person/outbox.hamlet @@ -20,11 +20,11 @@ $# . ^{pageNav}
- $forall Entity _ (OutboxItem _ doc published) <- items + $forall Entity itemID (OutboxItem _ doc published) <- items $with obj <- persistJSONObject doc
Published - + #{showTime published} $maybe summary <- objectSummary obj