This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Ensure scalar_token is valid before opening integrations manager#2777
Merged
Ensure scalar_token is valid before opening integrations manager#2777
Conversation
rxl881
approved these changes
Mar 12, 2019
Contributor
rxl881
left a comment
There was a problem hiding this comment.
This looks plausible to me (assuming it's tested and working).
jryans
approved these changes
Mar 12, 2019
Collaborator
jryans
left a comment
There was a problem hiding this comment.
There are a few spacing issues we should fix before merging, but otherwise it looks good to me. 😁
Free free to fix and merge yourself when done.
| null, | ||
| }, "mx_IntegrationsManager"); | ||
| }, (err) => { | ||
| this.setState({ scalarError: err}); |
Collaborator
There was a problem hiding this comment.
Nit: Please balance the spacing in this object
| }, "mx_IntegrationsManager"); | ||
| this.setState({showStickers: false}); | ||
| }, (err) => { | ||
| this.setState({ imError: err}); |
Collaborator
There was a problem hiding this comment.
Nit: Please balance the spacing in this object
Since Scalar (and other integration managers) are loaded as apps into an iframe, a valid `scalar_token` must exist when loading the app. It is possible that a scalar_token becomes invalid between the time when the integration manager button was rendered and the user clicking the link. Here we make a call to integration manager `/account` before trying to render the integration manager, which ensures we have a valid token for the integration manager to work with. Moving the scalar token revalidation to the cases where it is actually needed could make it possible to decrease the amount of Scalar /account calls we do when switching rooms, which is currently 3. Signed-off-by: Jason Robinson <jasonr@matrix.org>
5f28cf9 to
02ff176
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since Scalar (and other integration managers) are loaded as apps into
an iframe, a valid
scalar_tokenmust exist when loading the app.It is possible that a scalar_token becomes invalid between the time
when the integration manager button was rendered and the user clicking
the link. Here we make a call to integration manager
/accountbefore trying to render the integration manager, which ensures we
have a valid token for the integration manager to work with.
Moving the scalar token revalidation to the cases where it is actually
needed could make it possible to decrease the amount of Scalar /account
calls we do when switching rooms, which is currently 3.
Signed-off-by: Jason Robinson jasonr@matrix.org