From 6d55b8c5d7685a8c25d9b93633de083563515ed9 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Tue, 21 May 2019 09:11:13 +0000 Subject: [PATCH] Display remote actor name in remote message view --- src/Vervis/Discussion.hs | 7 ++++--- src/Vervis/Handler/Discussion.hs | 1 + templates/discussion/widget/message.hamlet | 2 +- templates/widget/actor-link.hamlet | 7 +++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Vervis/Discussion.hs b/src/Vervis/Discussion.hs index 2e0cb35..9b06d8b 100644 --- a/src/Vervis/Discussion.hs +++ b/src/Vervis/Discussion.hs @@ -42,7 +42,7 @@ import Vervis.Model data MessageTreeNodeAuthor = MessageTreeNodeLocal LocalMessageId Sharer - | MessageTreeNodeRemote Text LocalURI LocalURI + | MessageTreeNodeRemote Text LocalURI LocalURI (Maybe Text) data MessageTreeNode = MessageTreeNode { mtnMessageId :: MessageId @@ -69,13 +69,14 @@ getMessages getdid = runDB $ do , i ^. InstanceHost , rm ^. RemoteMessageIdent , rs ^. RemoteActorIdent + , rs ^. RemoteActorName ) return $ map mklocal l ++ map mkremote r where mklocal (Entity mid m, Value lmid, Entity _ s) = MessageTreeNode mid m $ MessageTreeNodeLocal lmid s - mkremote (Entity mid m, Value h, Value luMsg, Value luAuthor) = - MessageTreeNode mid m $ MessageTreeNodeRemote h luMsg luAuthor + mkremote (Entity mid m, Value h, Value luMsg, Value luAuthor, Value name) = + MessageTreeNode mid m $ MessageTreeNodeRemote h luMsg luAuthor name discussionTree :: [MessageTreeNode] -> Forest MessageTreeNode discussionTree mss = diff --git a/src/Vervis/Handler/Discussion.hs b/src/Vervis/Handler/Discussion.hs index cac86c3..30b3ecf 100644 --- a/src/Vervis/Handler/Discussion.hs +++ b/src/Vervis/Handler/Discussion.hs @@ -90,6 +90,7 @@ getNode getdid mid = do (instanceHost i) (remoteMessageIdent rm) (remoteActorIdent rs) + (remoteActorName rs) return $ MessageTreeNode mid m author {- diff --git a/templates/discussion/widget/message.hamlet b/templates/discussion/widget/message.hamlet index 4493557..e9824fb 100644 --- a/templates/discussion/widget/message.hamlet +++ b/templates/discussion/widget/message.hamlet @@ -18,7 +18,7 @@ $# . $of MessageTreeNodeLocal lmid s #{showTime $ messageCreated msg} - $of MessageTreeNodeRemote h luMsg _luAuthor + $of MessageTreeNodeRemote h luMsg _luAuthor _mname #{showTime $ messageCreated msg}
diff --git a/templates/widget/actor-link.hamlet b/templates/widget/actor-link.hamlet index 3b26a9c..c22ca27 100644 --- a/templates/widget/actor-link.hamlet +++ b/templates/widget/actor-link.hamlet @@ -21,8 +21,11 @@ $case actor #{shr2text $ sharerIdent s} ./s/#{shr2text $ sharerIdent s} - $of MessageTreeNodeRemote h _luMsg luAuthor + $of MessageTreeNodeRemote h _luMsg luAuthor mname - (?) + $maybe name <- mname + #{name} + $nothing + (?) #{shortURI h luAuthor}