@@ -42,6 +42,7 @@ import Bulk.Codecs
4242 , nid2rootid
4343 , nodeFromFragment
4444 , tensionAction2NodeType
45+ , toLink
4546 , uriFromNameid
4647 , uriFromUsername
4748 )
@@ -487,6 +488,14 @@ init global flags =
487488 nodeView =
488489 Dict . get " v" query |> withDefault [] |> List . head |> withDefault " " |> NodeDoc . nodeViewDecoder
489490
491+ path_data =
492+ ternary fs. orgChange Loading ( fromMaybeData global. session. path_data Loading )
493+
494+ focusid =
495+ withMaybeData path_data
496+ |> Maybe . map ( \ p -> p. focus. nameid)
497+ |> withDefault newFocus. nameid
498+
490499 model =
491500 { node_focus = newFocus
492501 , lookup_users = []
@@ -496,7 +505,7 @@ init global flags =
496505 , activeTab = tab
497506 , nodeView = nodeView
498507 , jumpTo = Dict . get " goto" query |> Maybe . map List . head |> withDefault Nothing
499- , path_data = ternary fs . orgChange Loading ( fromMaybeData global . session . path_data Loading )
508+ , path_data = path_data
500509 , tension_head = ternary fs. orgChange Loading ( fromMaybeData global. session. tension_head Loading )
501510 , focusState = fs
502511 , tension_comments = Loading
@@ -520,7 +529,7 @@ init global flags =
520529 , title_result = NotAsked
521530
522531 -- Comment Edit
523- , comment_form = initCommentPatchForm ( toReflink conf. url) global . session . user
532+ , comment_form = initCommentPatchForm global . session . user [ ( " reflink " , toReflink conf. url ) , ( " focusid " , focusid ) ]
524533 , comment_result = NotAsked
525534
526535 -- Blob Edit
@@ -1121,8 +1130,11 @@ update global message model =
11211130 other ->
11221131 other
11231132
1133+ focusid =
1134+ withMaybeData model. path_data |> Maybe . map ( \ p -> p. focus. nameid) |> withDefault model. node_focus. nameid
1135+
11241136 resetForm =
1125- initCommentPatchForm ( toReflink model. conf. url) global . session . user
1137+ initCommentPatchForm global . session . user [ ( " reflink " , toReflink model. conf. url ) , ( " focusid " , focusid ) ]
11261138 in
11271139 ( { model | tension_comments = tension_c, comment_form = resetForm, comment_result = result }, Cmd . none, Ports . bulma_driver " " )
11281140
@@ -2072,7 +2084,7 @@ viewComments conf action history_m comments_m comment_form comment_result expand
20722084 Just _ ->
20732085 case LE . getAt e. i history of
20742086 Just event ->
2075- viewEvent conf action event
2087+ viewEvent conf ( Dict . get " focusid " comment_form . post ) action event
20762088
20772089 Nothing ->
20782090 text " "
@@ -2170,8 +2182,8 @@ viewComments conf action history_m comments_m comment_form comment_result expand
21702182 |> div []
21712183
21722184
2173- viewEvent : Conf -> Maybe TensionAction .TensionAction -> Event -> Html Msg
2174- viewEvent conf action event =
2185+ viewEvent : Conf -> Maybe String -> Maybe TensionAction .TensionAction -> Event -> Html Msg
2186+ viewEvent conf focusid_m action event =
21752187 let
21762188 eventView =
21772189 case event. event_type of
@@ -2200,10 +2212,10 @@ viewEvent conf action event =
22002212 viewEventAssignee conf. lang conf. now event False
22012213
22022214 TensionEvent . LabelAdded ->
2203- viewEventLabel conf. lang conf. now event True
2215+ viewEventLabel focusid_m conf. lang conf. now event True
22042216
22052217 TensionEvent . LabelRemoved ->
2206- viewEventLabel conf. lang conf. now event False
2218+ viewEventLabel focusid_m conf. lang conf. now event False
22072219
22082220 TensionEvent . BlobPushed ->
22092221 viewEventPushed conf. lang conf. now event action
@@ -2362,8 +2374,8 @@ viewEventAssignee lang now event isNew =
23622374 ]
23632375
23642376
2365- viewEventLabel : Lang .Lang -> Time .Posix -> Event -> Bool -> List (Html Msg )
2366- viewEventLabel lang now event isNew =
2377+ viewEventLabel : Maybe String -> Lang .Lang -> Time .Posix -> Event -> Bool -> List (Html Msg )
2378+ viewEventLabel focusid_m lang now event isNew =
23672379 let
23682380 icon =
23692381 A . icon " icon-tag"
@@ -2377,12 +2389,19 @@ viewEventLabel lang now event isNew =
23772389
23782390 label =
23792391 Label " " ( SE . leftOfBack " §" value) ( SE . rightOfBack " §" value |> Just ) []
2392+
2393+ link =
2394+ Maybe . map
2395+ ( \ nid ->
2396+ toLink TensionsBaseUri nid [] ++ ( " ?l=" ++ label. name)
2397+ )
2398+ focusid_m
23802399 in
23812400 [ div [ class " media-left" ] [ icon ]
23822401 , div [ class " media-content" ]
2383- [ span [] <|
2402+ [ span [ class " labelsList " ] <|
23842403 List . intersperse ( text " " )
2385- [ viewUsernameLink event. createdBy. username, strong [] [ text actionText ], viewLabel " " Nothing label, text ( formatDate lang now event. createdAt) ]
2404+ [ viewUsernameLink event. createdBy. username, strong [] [ text actionText ], viewLabel " " link label, text ( formatDate lang now event. createdAt) ]
23862405 ]
23872406 ]
23882407
0 commit comments