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

Give user feedback if the rageshake submission failed #2621

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/settings/FeedbackSettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@
disabled={sending || sent}
/>
</FieldRow>
{sent ? (
<Body> {t("settings.feedback_tab_thank_you")}</Body>
) : (
{!sent && (

Check warning on line 69 in src/settings/FeedbackSettingsTab.tsx

View check run for this annotation

Codecov / codecov/patch

src/settings/FeedbackSettingsTab.tsx#L69

Added line #L69 was not covered by tests
<FieldRow>
<InputField
id="sendLogs"
Expand All @@ -77,16 +75,15 @@
type="checkbox"
defaultChecked
/>
{error && (
<FieldRow>
<ErrorMessage error={error} />
</FieldRow>
)}
<Button type="submit" disabled={sending}>
{sending ? t("submitting") : t("action.submit")}
</Button>
</FieldRow>
)}
<FieldRow>
{error && <ErrorMessage error={error} />}

Check warning on line 84 in src/settings/FeedbackSettingsTab.tsx

View check run for this annotation

Codecov / codecov/patch

src/settings/FeedbackSettingsTab.tsx#L83-L84

Added lines #L83 - L84 were not covered by tests
{sent && <Body> {t("settings.feedback_tab_thank_you")}</Body>}
</FieldRow>

Check warning on line 86 in src/settings/FeedbackSettingsTab.tsx

View check run for this annotation

Codecov / codecov/patch

src/settings/FeedbackSettingsTab.tsx#L86

Added line #L86 was not covered by tests
</form>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion src/settings/submit-rageshake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,17 @@
);
}

await fetch(Config.get().rageshake!.submit_url, {
const res = await fetch(Config.get().rageshake!.submit_url, {

Check warning on line 273 in src/settings/submit-rageshake.ts

View check run for this annotation

Codecov / codecov/patch

src/settings/submit-rageshake.ts#L273

Added line #L273 was not covered by tests
method: "POST",
body,
});

if (res.status !== 200) {
throw new Error(
`Failed to submit feedback: receive HTTP ${res.status} ${res.statusText}`,
);
}

Check warning on line 282 in src/settings/submit-rageshake.ts

View check run for this annotation

Codecov / codecov/patch

src/settings/submit-rageshake.ts#L278-L282

Added lines #L278 - L282 were not covered by tests

setState({ sending: false, sent: true, error: undefined });
} catch (error) {
setState({ sending: false, sent: false, error: error as Error });
Expand Down