-
Notifications
You must be signed in to change notification settings - Fork 338
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
Improve error handling (fixes #897) #1013
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { InitialFetchRequest } from "../../interfaces"; | |
import { WebSocketService } from "../../services"; | ||
import { | ||
capitalizeFirstLetter, | ||
check_auth, | ||
isBrowser, | ||
myAuth, | ||
randomStr, | ||
|
@@ -60,6 +61,8 @@ export class AdminSettings extends Component<any, AdminSettingsState> { | |
this.parseMessage = this.parseMessage.bind(this); | ||
this.subscription = wsSubscribe(this.parseMessage); | ||
|
||
check_auth(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of doing this on the client, I think it would better to handle this on the server and redirect the user before even sending the page that requires auth back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest Im not good at frontend dev. If you want you can take over this PR because it takes me forever just to implement the basics. So Id rather stay in Rust :) |
||
|
||
// Only fetch the data if coming from another route | ||
if (this.isoData.path == this.context.router.route.match.url) { | ||
this.state = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be improved further by displaying the error message as a full page with normal header and footer (if
site
was requested successfully). In case of error 401 it can also redirect to /login like some routes already do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first part was mentioned in #982. If you don't do it as part of this PR, I could whip something up. I'm wondering: if the site returns a server error but the site is still fetched, is it a good idea to list the matrix user IDs of instance admins for users to reach out to for support? That information is already on the site response, so no further requests would be required.