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

fix: Handle failure when fetching user preferences #2069

Merged
merged 1 commit into from
May 5, 2023

Conversation

natsukagami
Copy link
Contributor

@natsukagami natsukagami commented May 5, 2023

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 failing
and 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 and reading:expand:spoilers doesn't seem
to 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 it
to the standards.

@stackblitz
Copy link

stackblitz bot commented May 5, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented May 5, 2023

Deploy Preview for elk-zone ready!

Name Link
🔨 Latest commit 9230c3f
🔍 Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/645539dac38d3b0008ab81e3
😎 Deploy Preview https://deploy-preview-2069--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 5, 2023

Deploy Preview for elk-docs canceled.

Name Link
🔨 Latest commit 9230c3f
🔍 Latest deploy log https://app.netlify.com/sites/elk-docs/deploys/645539d9d6391400087beba9

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 failing
and causing the whole `fetchAccountInfo` function to throw,
effectively logging the user out.
@natsukagami natsukagami changed the title Handle failure when fetching user preferences fix: Handle failure when fetching user preferences May 5, 2023
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Looks good, sorry for the glitch in GoToSocial. We should have left the change in main.elk.zone for a bit longer (although I don't know how many GoToSocial users are in the main channel testing right now). Let's merge and do a quick release to avoid further issues

@patak-dev patak-dev merged commit 1487932 into elk-zone:main May 5, 2023
12 of 13 checks passed
@patak-dev
Copy link
Member

@natsukagami 0.9.5 includes this fix, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants