Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5-internal/pr-3035
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed broken stern endpoint `POST i/user/meta-info`
6 changes: 3 additions & 3 deletions tools/stern/src/Stern/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,15 @@ getUserData uid = do
convs <- Intra.getUserConversations uid
clts <- Intra.getUserClients uid
notfs <- Intra.getUserNotifications uid
consent <- Intra.getUserConsentValue uid
consentLog <- Intra.getUserConsentLog uid
consent <- (Intra.getUserConsentValue uid <&> Just) `catchE` \_ -> pure Nothing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these catch internal errors as well? do we want that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I just noticed that these fail and make the whole request fail, which is unnecessary, IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made a change, see comment below

consentLog <- (Intra.getUserConsentLog uid <&> Just) `catchE` \_ -> pure Nothing
cookies <- Intra.getUserCookies uid
properties <- Intra.getUserProperties uid
-- Get all info from Marketo too
let em = userEmail $ accountUser account
marketo <- do
let noEmail = MarketoResult $ KeyMap.singleton "results" emptyArray
maybe (pure noEmail) Intra.getMarketoResult em
maybe (pure noEmail) (\e -> Intra.getMarketoResult e `catchE` \_ -> pure noEmail) em
pure . UserMetaInfo . KeyMap.fromList $
[ "account" .= account,
"cookies" .= cookies,
Expand Down
6 changes: 4 additions & 2 deletions tools/stern/src/Stern/Intra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ import Wire.API.Internal.Notification
import Wire.API.Properties
import Wire.API.Routes.Internal.Brig.Connection
import qualified Wire.API.Routes.Internal.Brig.EJPD as EJPD
import Wire.API.Routes.Version
import Wire.API.Routes.Versioned
import Wire.API.Team
import Wire.API.Team.Feature
import qualified Wire.API.Team.Feature as Public
Expand Down Expand Up @@ -744,12 +746,12 @@ getUserConversations uid = do
b
( method GET
. header "Z-User" (toByteString' uid)
. path "/conversations"
. path "/v2/conversations"
. queryItem "size" (toByteString' batchSize)
. maybe id (queryItem "start" . toByteString') start
. expect2xx
)
parseResponse (mkError status502 "bad-upstream") r
unVersioned @'V2 <$> parseResponse (mkError status502 "bad-upstream") r

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wouldn't have happened if we used servant-client for calling internal api end-points... :)

batchSize = 100 :: Int

getUserClients :: UserId -> Handler [Client]
Expand Down