Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-53015] Allow the user_agent field to be included in context #480

Merged
merged 4 commits into from
Sep 27, 2023

Conversation

kyeongsoosoo
Copy link
Contributor

Summary

When the InvokeCall method is executed, AppContext is assigned an expanded context.

// expand
expanded, err := p.expandContext(r, app, &creq.Context, creq.Expand, expandGetter)
if err != nil {
return nil, errors.Wrap(err, "failed to expand context")
}
creq.Context = *expanded

I found that the user_agent field disappears because expandContext method initializes the UserAgentContext when it runs.
I changed the user_agent and track_as_submit fields to keep their original values on initialization.

// Cleanup fields that must not go to the app.
e.Context.UserAgentContext = apps.UserAgentContext{}

Ticket Link

Fixes mattermost/mattermost#23621
JIRA https://mattermost.atlassian.net/browse/MM-53015

@mattermost-build
Copy link
Contributor

Hello @kyeongsoosoo,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@hanzei hanzei added the 2: Dev Review Requires review by a core committer label Sep 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03% 🎉

Comparison is base (89a1e4c) 20.12% compared to head (6a56b64) 20.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
+ Coverage   20.12%   20.16%   +0.03%     
==========================================
  Files          80       80              
  Lines        6609     6612       +3     
==========================================
+ Hits         1330     1333       +3     
  Misses       5147     5147              
  Partials      132      132              
Files Changed Coverage Δ
server/proxy/expand.go 46.01% <100.00%> (+0.41%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kyeongsoosoo
Copy link
Contributor Author

/update-branch

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution and also for adding tests 👍

@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer Lifecycle/1:stale labels Sep 27, 2023
@hanzei hanzei added this to the v1.3.0 milestone Sep 27, 2023
@hanzei hanzei merged commit de487d6 into mattermost:master Sep 27, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User agent is not send via Call Request
5 participants