fix: Handle failure when fetching user preferences #2069
Merged
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.
If fetching preferences fail, continue with no known preferences.
Some servers (such as the current latest version of GoToSocial)
has not implemented the
GET /preferences
endpoint. This API call is failingand causing the whole
fetchAccountInfo
function to throw,effectively logging the user out.
I've also contacted the GoToSocial guys to quickly write up an endpoint,
but this would be a quicker fix as opposed to all GtS users failing to log into
their instance from Elk (we get logged out immediately after authentication as of now).
Note that some of the preferences shown up in the API,
particularly
reading:expand:media
andreading:expand:spoilers
doesn't seemto even have an endpoint where it can be set at the moment.
I don't know what is the standard for "show an error, that is probably not very important
to the user" in the codebase, so I just left a
console.warn
for now. Feel free to edit itto the standards.