From a60b05b1cae4c0c7b95bf9f7afcec6a8d280355e Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Sat, 27 Apr 2024 23:17:22 +0300 Subject: [PATCH] UI: Error-inbox ("Errbox") display for all local actors --- src/Vervis/Foundation.hs | 7 +++++++ src/Vervis/Handler/Deck.hs | 4 ++++ src/Vervis/Handler/Group.hs | 4 ++++ src/Vervis/Handler/Loom.hs | 4 ++++ src/Vervis/Handler/Person.hs | 4 ++++ src/Vervis/Handler/Project.hs | 4 ++++ src/Vervis/Handler/Repo.hs | 4 ++++ src/Vervis/Web/Actor.hs | 7 +++++-- templates/deck/widget/nav.hamlet | 5 ++++- templates/default-layout.hamlet | 5 ++++- templates/group/nav.hamlet | 5 ++++- templates/loom/widget/nav.hamlet | 5 ++++- templates/person/widget/nav.hamlet | 5 ++++- templates/project/widget/nav.hamlet | 5 ++++- templates/repo/source-darcs.hamlet | 3 +++ templates/repo/source-git.hamlet | 3 +++ th/routes | 6 ++++++ 17 files changed, 72 insertions(+), 8 deletions(-) diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 62fa8d4..ac9c33d 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -1048,3 +1048,10 @@ instance YesodBreadcrumbs App where ProjectApproveChildR _ _ -> ("", Nothing) ProjectApproveParentR _ _ -> ("", Nothing) + + PersonErrboxR p -> ("Errbox", Just $ PersonR p) + GroupErrboxR g -> ("Errbox", Just $ GroupR g) + ProjectErrboxR j -> ("Errbox", Just $ ProjectR j) + RepoErrboxR r -> ("Errbox", Just $ RepoR r) + DeckErrboxR d -> ("Errbox", Just $ DeckR d) + LoomErrboxR l -> ("Errbox", Just $ LoomR l) diff --git a/src/Vervis/Handler/Deck.hs b/src/Vervis/Handler/Deck.hs index 30e02bd..4279130 100644 --- a/src/Vervis/Handler/Deck.hs +++ b/src/Vervis/Handler/Deck.hs @@ -17,6 +17,7 @@ module Vervis.Handler.Deck ( getDeckR , getDeckInboxR + , getDeckErrboxR , postDeckInboxR , getDeckOutboxR , getDeckOutboxItemR @@ -187,6 +188,9 @@ getDeckR deckHash = do getDeckInboxR :: KeyHashid Deck -> Handler TypedContent getDeckInboxR = getInbox DeckInboxR deckActor +getDeckErrboxR :: KeyHashid Deck -> Handler TypedContent +getDeckErrboxR = getInbox' actorErrbox DeckErrboxR deckActor + postDeckInboxR :: KeyHashid Deck -> Handler () postDeckInboxR deckHash = do deckID <- decodeKeyHashid404 deckHash diff --git a/src/Vervis/Handler/Group.hs b/src/Vervis/Handler/Group.hs index beccf20..0c82dcd 100644 --- a/src/Vervis/Handler/Group.hs +++ b/src/Vervis/Handler/Group.hs @@ -20,6 +20,7 @@ module Vervis.Handler.Group , getGroupR , getGroupInboxR + , getGroupErrboxR , postGroupInboxR , getGroupOutboxR , getGroupOutboxItemR @@ -211,6 +212,9 @@ getGroupR groupHash = do getGroupInboxR :: KeyHashid Group -> Handler TypedContent getGroupInboxR = getInbox GroupInboxR groupActor +getGroupErrboxR :: KeyHashid Group -> Handler TypedContent +getGroupErrboxR = getInbox' actorErrbox GroupErrboxR groupActor + postGroupInboxR :: KeyHashid Group -> Handler () postGroupInboxR groupHash = do groupID <- decodeKeyHashid404 groupHash diff --git a/src/Vervis/Handler/Loom.hs b/src/Vervis/Handler/Loom.hs index 6b56328..ce99a12 100644 --- a/src/Vervis/Handler/Loom.hs +++ b/src/Vervis/Handler/Loom.hs @@ -16,6 +16,7 @@ module Vervis.Handler.Loom ( getLoomR , getLoomInboxR + , getLoomErrboxR , postLoomInboxR , getLoomOutboxR , getLoomOutboxItemR @@ -143,6 +144,9 @@ getLoomR loomHash = do getLoomInboxR :: KeyHashid Loom -> Handler TypedContent getLoomInboxR = getInbox LoomInboxR loomActor +getLoomErrboxR :: KeyHashid Loom -> Handler TypedContent +getLoomErrboxR = getInbox' actorErrbox LoomErrboxR loomActor + postLoomInboxR :: KeyHashid Loom -> Handler () postLoomInboxR loomHash = do loomID <- decodeKeyHashid404 loomHash diff --git a/src/Vervis/Handler/Person.hs b/src/Vervis/Handler/Person.hs index e80a72c..23f0d02 100644 --- a/src/Vervis/Handler/Person.hs +++ b/src/Vervis/Handler/Person.hs @@ -17,6 +17,7 @@ module Vervis.Handler.Person ( getPersonR , getPersonInboxR + , getPersonErrboxR , postPersonInboxR , getPersonOutboxR , postPersonOutboxR @@ -139,6 +140,9 @@ getPersonR personHash = do getPersonInboxR :: KeyHashid Person -> Handler TypedContent getPersonInboxR = getInbox PersonInboxR personActor +getPersonErrboxR :: KeyHashid Person -> Handler TypedContent +getPersonErrboxR = getInbox' actorErrbox PersonErrboxR personActor + postPersonInboxR :: KeyHashid Person -> Handler () postPersonInboxR personHash = do personID <- decodeKeyHashid404 personHash diff --git a/src/Vervis/Handler/Project.hs b/src/Vervis/Handler/Project.hs index 33144ca..cf10fb0 100644 --- a/src/Vervis/Handler/Project.hs +++ b/src/Vervis/Handler/Project.hs @@ -17,6 +17,7 @@ module Vervis.Handler.Project ( getProjectR , getProjectInboxR + , getProjectErrboxR , postProjectInboxR , getProjectOutboxR , getProjectOutboxItemR @@ -191,6 +192,9 @@ getProjectR projectHash = do getProjectInboxR :: KeyHashid Project -> Handler TypedContent getProjectInboxR = getInbox ProjectInboxR projectActor +getProjectErrboxR :: KeyHashid Project -> Handler TypedContent +getProjectErrboxR = getInbox' actorErrbox ProjectErrboxR projectActor + postProjectInboxR :: KeyHashid Project -> Handler () postProjectInboxR projectHash = do projectID <- decodeKeyHashid404 projectHash diff --git a/src/Vervis/Handler/Repo.hs b/src/Vervis/Handler/Repo.hs index 763ba02..f2f4642 100644 --- a/src/Vervis/Handler/Repo.hs +++ b/src/Vervis/Handler/Repo.hs @@ -17,6 +17,7 @@ module Vervis.Handler.Repo ( getRepoR , getRepoInboxR + , getRepoErrboxR , postRepoInboxR , getRepoOutboxR , getRepoOutboxItemR @@ -243,6 +244,9 @@ getRepoR repoHash = do getRepoInboxR :: KeyHashid Repo -> Handler TypedContent getRepoInboxR = getInbox RepoInboxR repoActor +getRepoErrboxR :: KeyHashid Repo -> Handler TypedContent +getRepoErrboxR = getInbox' actorErrbox RepoErrboxR repoActor + postRepoInboxR :: KeyHashid Repo -> Handler () postRepoInboxR repoHash = do repoID <- decodeKeyHashid404 repoHash diff --git a/src/Vervis/Web/Actor.hs b/src/Vervis/Web/Actor.hs index e5487e1..2560b59 100644 --- a/src/Vervis/Web/Actor.hs +++ b/src/Vervis/Web/Actor.hs @@ -16,6 +16,7 @@ module Vervis.Web.Actor ( getInbox + , getInbox' , postInbox , getOutbox , getOutboxItem @@ -135,12 +136,14 @@ objectId o = "'id' field not found" ++ TL.unpack (P.encodePrettyToLazyText o) -getInbox here actor hash = do +getInbox = getInbox' actorInbox + +getInbox' grabInbox here actor hash = do key <- decodeKeyHashid404 hash (total, pages, mpage) <- runDB $ do inboxID <- do actorID <- actor <$> get404 key - actorInbox <$> getJust actorID + grabInbox <$> getJust actorID getPageAndNavCount (countItems inboxID) (\ off lim -> map adaptItem <$> getItems inboxID off lim) diff --git a/templates/deck/widget/nav.hamlet b/templates/deck/widget/nav.hamlet index 37fedf2..3fab892 100644 --- a/templates/deck/widget/nav.hamlet +++ b/templates/deck/widget/nav.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2019, 2022, 2023 by fr33domlover . +$# Written in 2019, 2022, 2023, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -24,6 +24,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 0767c6c..c6d937f 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2016, 2019, 2022 by fr33domlover . +$# Written in 2016, 2019, 2022, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -29,6 +29,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/group/nav.hamlet b/templates/group/nav.hamlet index 7866ddf..0d0acd9 100644 --- a/templates/group/nav.hamlet +++ b/templates/group/nav.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2019, 2022, 2023 by fr33domlover . +$# Written in 2019, 2022, 2023, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -24,6 +24,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/loom/widget/nav.hamlet b/templates/loom/widget/nav.hamlet index 8146542..ba7e005 100644 --- a/templates/loom/widget/nav.hamlet +++ b/templates/loom/widget/nav.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2019, 2022, 2023 by fr33domlover . +$# Written in 2019, 2022, 2023, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -24,6 +24,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/person/widget/nav.hamlet b/templates/person/widget/nav.hamlet index 1c3a486..a0c9cd7 100644 --- a/templates/person/widget/nav.hamlet +++ b/templates/person/widget/nav.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2019, 2020, 2022 by fr33domlover . +$# Written in 2019, 2020, 2022, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -24,6 +24,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/project/widget/nav.hamlet b/templates/project/widget/nav.hamlet index 8be0178..db9dbc4 100644 --- a/templates/project/widget/nav.hamlet +++ b/templates/project/widget/nav.hamlet @@ -1,6 +1,6 @@ $# This file is part of Vervis. $# -$# Written in 2019, 2022, 2023 by fr33domlover . +$# Written in 2019, 2022, 2023, 2024 by fr33domlover . $# $# ♡ Copying is an act of love. Please copy, reuse and share. $# @@ -24,6 +24,9 @@ $# . [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/repo/source-darcs.hamlet b/templates/repo/source-darcs.hamlet index f2e270f..3ec4117 100644 --- a/templates/repo/source-darcs.hamlet +++ b/templates/repo/source-darcs.hamlet @@ -42,6 +42,9 @@ $# ^{personNavW user} [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/templates/repo/source-git.hamlet b/templates/repo/source-git.hamlet index f23bf43..90e0685 100644 --- a/templates/repo/source-git.hamlet +++ b/templates/repo/source-git.hamlet @@ -42,6 +42,9 @@ $# ^{personNavW user} [📤 Outbox] + + + [💥 Errbox] [🐤 Followers] diff --git a/th/routes b/th/routes index de39fe1..7e1d89c 100644 --- a/th/routes +++ b/th/routes @@ -144,6 +144,7 @@ /people/#PersonKeyHashid PersonR GET /people/#PersonKeyHashid/inbox PersonInboxR GET POST +/people/#PersonKeyHashid/errbox PersonErrboxR GET /people/#PersonKeyHashid/outbox PersonOutboxR GET POST /people/#PersonKeyHashid/outbox/#OutboxItemKeyHashid PersonOutboxItemR GET /people/#PersonKeyHashid/followers PersonFollowersR GET @@ -164,6 +165,7 @@ /groups/#GroupKeyHashid GroupR GET /groups/#GroupKeyHashid/inbox GroupInboxR GET POST +/groups/#GroupKeyHashid/errbox GroupErrboxR GET /groups/#GroupKeyHashid/outbox GroupOutboxR GET /groups/#GroupKeyHashid/outbox/#OutboxItemKeyHashid GroupOutboxItemR GET /groups/#GroupKeyHashid/followers GroupFollowersR GET @@ -184,6 +186,7 @@ /repos/#RepoKeyHashid RepoR GET /repos/#RepoKeyHashid/inbox RepoInboxR GET POST +/repos/#RepoKeyHashid/errbox RepoErrboxR GET /repos/#RepoKeyHashid/outbox RepoOutboxR GET /repos/#RepoKeyHashid/outbox/#OutboxItemKeyHashid RepoOutboxItemR GET /repos/#RepoKeyHashid/followers RepoFollowersR GET @@ -218,6 +221,7 @@ /decks/#DeckKeyHashid DeckR GET /decks/#DeckKeyHashid/inbox DeckInboxR GET POST +/decks/#DeckKeyHashid/errbox DeckErrboxR GET /decks/#DeckKeyHashid/outbox DeckOutboxR GET /decks/#DeckKeyHashid/outbox/#OutboxItemKeyHashid DeckOutboxItemR GET /decks/#DeckKeyHashid/followers DeckFollowersR GET @@ -276,6 +280,7 @@ /looms/#LoomKeyHashid LoomR GET /looms/#LoomKeyHashid/inbox LoomInboxR GET POST +/looms/#LoomKeyHashid/errbox LoomErrboxR GET /looms/#LoomKeyHashid/outbox LoomOutboxR GET /looms/#LoomKeyHashid/outbox/#OutboxItemKeyHashid LoomOutboxItemR GET /looms/#LoomKeyHashid/followers LoomFollowersR GET @@ -331,6 +336,7 @@ /projects/#ProjectKeyHashid ProjectR GET /projects/#ProjectKeyHashid/inbox ProjectInboxR GET POST +/projects/#ProjectKeyHashid/errbox ProjectErrboxR GET /projects/#ProjectKeyHashid/outbox ProjectOutboxR GET /projects/#ProjectKeyHashid/outbox/#OutboxItemKeyHashid ProjectOutboxItemR GET /projects/#ProjectKeyHashid/followers ProjectFollowersR GET