From b519bbe7b9c42a3e82d67b3e044bd8fee809aa9b Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Sat, 27 Apr 2024 19:29:33 +0300 Subject: [PATCH] UI: Inbox: For each item, display the result of processing --- src/Vervis/Web/Actor.hs | 13 ++++++++----- templates/person/inbox.hamlet | 10 +++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Vervis/Web/Actor.hs b/src/Vervis/Web/Actor.hs index 9d09bf8..e5487e1 100644 --- a/src/Vervis/Web/Actor.hs +++ b/src/Vervis/Web/Actor.hs @@ -1,6 +1,7 @@ {- This file is part of Vervis. - - - Written in 2019, 2020, 2022, 2023 by fr33domlover . + - Written in 2019, 2020, 2022, 2023, 2024 + - by fr33domlover . - - ♡ Copying is an act of love. Please copy, reuse and share. - @@ -53,6 +54,7 @@ import Data.Traversable import Database.Persist import Database.Persist.Sql import Network.HTTP.Types.Status +import Optics.Core import Text.Blaze.Html (Html, preEscapedToHtml) import Text.Blaze.Html.Renderer.Text import Text.HTML.SanitizeXSS @@ -181,7 +183,7 @@ getInbox here actor hash = do then Just $ pageUrl $ current + 1 else Nothing , collectionPageStartIndex = Nothing - , collectionPageItems = map fst items + , collectionPageItems = map (view _1) items } provideRep $ do let pageNav = navWidget navModel @@ -215,18 +217,19 @@ getInbox here actor hash = do , ob E.?. OutboxItemPublished , ract E.?. RemoteActivityContent , ract E.?. RemoteActivityReceived + , ib E.^. InboxItemResult ) adaptItem - (E.Value ibid, E.Value mact, E.Value mpub, E.Value mobj, E.Value mrec) = + (E.Value ibid, E.Value mact, E.Value mpub, E.Value mobj, E.Value mrec, E.Value result) = case (mact, mpub, mobj, mrec) of (Nothing, Nothing, Nothing, Nothing) -> error $ ibiidString ++ " neither local nor remote" (Just _, Just _, Just _, Just _) -> error $ ibiidString ++ " both local and remote" (Just act, Just pub, Nothing, Nothing) -> - (persistJSONObject act, (pub, False)) + (persistJSONObject act, (pub, False), result) (Nothing, Nothing, Just obj, Just rec) -> - (persistJSONObject obj, (rec, True)) + (persistJSONObject obj, (rec, True), result) _ -> error $ "Unexpected query result for " ++ ibiidString where ibiidString = "InboxItem #" ++ show (fromSqlKey ibid) diff --git a/templates/person/inbox.hamlet b/templates/person/inbox.hamlet index ad4931f..b78b098 100644 --- a/templates/person/inbox.hamlet +++ b/templates/person/inbox.hamlet @@ -20,7 +20,7 @@ $# . ^{pageNav}
- $forall (obj, (time, isRemote)) <- items + $forall (obj, (time, isRemote), result) <- items