Display summary and pretty JSON for notifications and for outboxes
This commit is contained in:
parent
2109974709
commit
d8da1f2abf
3 changed files with 17 additions and 8 deletions
|
@ -127,6 +127,11 @@ import Vervis.RemoteActorStore
|
||||||
import Yesod.RenderSource
|
import Yesod.RenderSource
|
||||||
import Vervis.Settings
|
import Vervis.Settings
|
||||||
|
|
||||||
|
objectSummary o =
|
||||||
|
case M.lookup "summary" o of
|
||||||
|
Just (String t) | not (T.null t) -> Just t
|
||||||
|
_ -> Nothing
|
||||||
|
|
||||||
getInboxR :: Handler Html
|
getInboxR :: Handler Html
|
||||||
getInboxR = do
|
getInboxR = do
|
||||||
acts <-
|
acts <-
|
||||||
|
@ -236,10 +241,6 @@ getInbox here getInboxId = do
|
||||||
error $ "InboxItem #" ++ show ibid ++ " both local and remote"
|
error $ "InboxItem #" ++ show ibid ++ " both local and remote"
|
||||||
(Just act, Nothing) -> persistJSONObject act
|
(Just act, Nothing) -> persistJSONObject act
|
||||||
(Nothing, Just obj) -> persistJSONObject obj
|
(Nothing, Just obj) -> persistJSONObject obj
|
||||||
objectSummary o =
|
|
||||||
case M.lookup "summary" o of
|
|
||||||
Just (String t) | not (T.null t) -> Just t
|
|
||||||
_ -> Nothing
|
|
||||||
|
|
||||||
getSharerInboxR :: ShrIdent -> Handler TypedContent
|
getSharerInboxR :: ShrIdent -> Handler TypedContent
|
||||||
getSharerInboxR shr = getInbox here getInboxId
|
getSharerInboxR shr = getInbox here getInboxId
|
||||||
|
|
|
@ -17,9 +17,12 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
<input type=submit value="Mark all as read">
|
<input type=submit value="Mark all as read">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
$forall (activity, widget, enctype) <- notifications
|
$forall (obj, widget, enctype) <- notifications
|
||||||
<div><pre>
|
$maybe summary <- objectSummary obj
|
||||||
#{TLB.toLazyText $ encodePrettyToTextBuilder activity}
|
<div>
|
||||||
|
^{preEscapedToHtml summary}
|
||||||
|
$nothing
|
||||||
|
^{renderPrettyJSONSkylighting obj}
|
||||||
<form method=POST action=@{NotificationsR shr} enctype=#{enctype}>
|
<form method=POST action=@{NotificationsR shr} enctype=#{enctype}>
|
||||||
^{widget}
|
^{widget}
|
||||||
<input type=submit value="Mark as read">
|
<input type=submit value="Mark as read">
|
||||||
|
|
|
@ -22,6 +22,11 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
<div>
|
<div>
|
||||||
$forall Entity _ (OutboxItem _ doc published) <- items
|
$forall Entity _ (OutboxItem _ doc published) <- items
|
||||||
<div>#{showTime published}
|
<div>#{showTime published}
|
||||||
<div>^{renderPrettyJSON' $ BL.fromStrict $ persistJSONBytes doc}
|
$with obj <- persistJSONObject doc
|
||||||
|
$maybe summary <- objectSummary obj
|
||||||
|
<div>
|
||||||
|
^{preEscapedToHtml summary}
|
||||||
|
$nothing
|
||||||
|
^{renderPrettyJSONSkylighting obj}
|
||||||
|
|
||||||
^{pageNav}
|
^{pageNav}
|
||||||
|
|
Loading…
Reference in a new issue