From facf4d7f3eb7abb7c7f89b7c16327394262ca0cc Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sun, 2 Jun 2019 12:04:35 +0000 Subject: [PATCH] Rename messageContent field to messageSource; content will soon be HTML --- config/models | 2 +- src/Vervis/Federation.hs | 4 ++-- src/Vervis/Handler/Discussion.hs | 2 +- src/Vervis/Migration.hs | 2 ++ templates/discussion/widget/message.hamlet | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config/models b/config/models index aa19879..2cb5f30 100644 --- a/config/models +++ b/config/models @@ -321,7 +321,7 @@ RemoteDiscussion Message created UTCTime - content Text -- Assume this is Pandoc Markdown + source Text -- Pandoc Markdown parent MessageId Maybe root DiscussionId diff --git a/src/Vervis/Federation.hs b/src/Vervis/Federation.hs index fe6c3e6..231b37c 100644 --- a/src/Vervis/Federation.hs +++ b/src/Vervis/Federation.hs @@ -812,7 +812,7 @@ handleProjectInbox now shrRecip prjRecip iidSender hSender raidSender body raw a } mid <- insert Message { messageCreated = published - , messageContent = content + , messageSource = content , messageParent = case meparent of Just (Left midParent) -> Just midParent @@ -1327,7 +1327,7 @@ handleOutboxNote host (Note mluNote luAttrib aud muParent muContext mpublished c now <- liftIO getCurrentTime mid <- insert Message { messageCreated = now - , messageContent = content + , messageSource = content , messageParent = case meparent of Just (Left midParent) -> Just midParent diff --git a/src/Vervis/Handler/Discussion.hs b/src/Vervis/Handler/Discussion.hs index 392cd03..c634e5d 100644 --- a/src/Vervis/Handler/Discussion.hs +++ b/src/Vervis/Handler/Discussion.hs @@ -164,7 +164,7 @@ getDiscussionMessage shr lmid = do , noteReplyTo = Just $ fromMaybe uContext muParent , noteContext = Just uContext , notePublished = Just $ messageCreated m - , noteContent = messageContent m + , noteContent = messageSource m } selectRep $ do provideAP $ pure doc diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index 78c7c51..cbc4595 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -486,6 +486,8 @@ changes hLocal ctx = , renameEntity "ProjectAccess" "RoleAccess" -- 84 , renameUnique "RoleAccess" "UniqueProjectAccess" "UniqueRoleAccess" + -- 85 + , renameField "Message" "content" "source" ] migrateDB :: MonadIO m => Text -> HashidsContext -> ReaderT SqlBackend m (Either Text (Int, Int)) diff --git a/templates/discussion/widget/message.hamlet b/templates/discussion/widget/message.hamlet index e9824fb..bd8359c 100644 --- a/templates/discussion/widget/message.hamlet +++ b/templates/discussion/widget/message.hamlet @@ -22,6 +22,6 @@ $# . #{showTime $ messageCreated msg}
- ^{showContent $ messageContent msg} + ^{showContent $ messageSource msg}
reply