We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit d32dd915 authored by Mitchell Rosen's avatar Mitchell Rosen

fixed edit comment preview (now shows new contents)

foo

foo
parent 3a5f795b
......@@ -345,7 +345,7 @@ postDeleteComment comment_id =
-- if there's a preview widget to display (per POST param "mode").
-- Permission checking should occur *PRIOR TO* this function.
postEditComment :: Entity User -> Entity Comment -> CommentHandlerInfo -> Handler (Maybe Widget)
postEditComment user comment@(Entity comment_id _) comment_handler_info = do
postEditComment user (Entity comment_id comment) comment_handler_info = do
((result, _), _) <- runFormPost (editCommentForm "")
case result of
FormSuccess (NewComment new_text _) -> lookupPostMode >>= \case
......@@ -359,13 +359,11 @@ postEditComment user comment@(Entity comment_id _) comment_handler_info = do
makeCommentActionWidget
can_edit
mempty
comment
(Entity comment_id (comment { commentText = new_text }))
user
comment_handler_info
(def { mod_comment = \c -> c { commentText = new_text }
-- Since an edit removes a flagging, don't show the flagged markup in preview.
, mod_flag_map = M.delete comment_id
})
-- Since an edit removes a flagging, don't show the flagged markup in preview.
(def { mod_flag_map = M.delete comment_id })
(getMaxDepthDefault 0)
True
return (Just (previewWidget form "post" comment_widget))
......
......@@ -94,17 +94,16 @@ data NoCommentReason
-- | Data type used in makeCommentWidgetMod, containing modifications to comment-action-related
-- data structures.
data CommentMods = CommentMods
{ mod_comment :: Comment -> Comment
, mod_earlier_closures :: [CommentClosure] -> [CommentClosure]
, mod_user_map :: Map UserId User -> Map UserId User -- can't user UserMap here, circular dependency.
, mod_closure_map :: ClosureMap -> ClosureMap
, mod_ticket_map :: TicketMap -> TicketMap
, mod_flag_map :: FlagMap -> FlagMap
, mod_tag_map :: TagMap -> TagMap
{ mod_earlier_closures :: [CommentClosure] -> [CommentClosure]
, mod_user_map :: Map UserId User -> Map UserId User
, mod_closure_map :: ClosureMap -> ClosureMap
, mod_ticket_map :: TicketMap -> TicketMap
, mod_flag_map :: FlagMap -> FlagMap
, mod_tag_map :: TagMap -> TagMap
}
instance Default CommentMods where
def = CommentMods id id id id id id id
def = CommentMods id id id id id id
data MaxDepth
= NoMaxDepth
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment