Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ All notable changes to OpenSignup are documented here. Format follows [Keep a Ch

### Fixed

- Clicking **Disconnect** on Settings → Connected apps for an app that was already disconnected, from another tab say, now says "That app is already disconnected." (#882), where it gave the "No longer available." every screen gives something that's gone. Any other failed disconnect now reads "Couldn’t disconnect. Try again." (was "Could not disconnect. Try again."). Both are in Swedish too.
- The organizer pages and the sign-in pages show the site's own name (#881). The breadcrumb's first link on every organizer page, the "Welcome to …" card for an organizer with no workspace, and the "Sign in to …" heading on `/login` and `/login/confirm` typed "OpenSignup"; they now show `NEXT_PUBLIC_INSTANCE_NAME`, as the site header, page titles and help already do. A self-hosted site with its own name no longer shows OpenSignup's. On a site named "OpenSignup" nothing changes. The sign-in email still says "OpenSignup" for now.
- On the unsubscribe page with reminders off, **Back to the signup** now sits a full line under **Turn reminders back on** (#1026). It sat 4px under it, so the two small text actions were too close to tap apart easily, and in Swedish they failed WCAG 2.2's minimum target size (2.5.8). The accessibility tests now check that page's spacing in English and in each other language, at desktop and phone widths.
- A signup link with a full stop, comma, closing bracket, ellipsis or other punctuation stuck to its end ("…/s/team-snacks-a7vc8.", as some apps and email clients take a sentence's last character into the link) now opens the signup (#986). It used to say the signup was no longer available. The page answers such a link with a permanent redirect to the signup's own address; only the end of the link is trimmed, so an unknown slug or a stray character in the middle still gets the not-found page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,33 @@ describe('Connected apps', () => {
);
});

it('says an app is already disconnected, or that a disconnect failed', async () => {
await renderPage({ error: 'not_found' });
expect(screen.getByRole('alert')).toHaveTextContent(/^That app is already disconnected\.$/);
cleanup();

await renderPage({ error: 'internal' });
expect(screen.getByRole('alert')).toHaveTextContent(/^Couldn’t disconnect\. Try again\.$/);
});

it.each(OTHER_LANGUAGES)(
'says a disconnect was refused in the organizer’s language, %s',
async (other) => {
ship('organizer', ['en', other]);
request.session.locale = other;
await renderPage({ error: 'not_found' });
expect(screen.getByRole('alert')).toHaveTextContent(
`organizer.errors.alreadyDisconnected in ${other}`,
);
cleanup();

await renderPage({ error: 'internal' });
expect(screen.getByRole('alert')).toHaveTextContent(
`organizer.errors.disconnectFailed in ${other}`,
);
},
);

it.each(OTHER_LANGUAGES)('is in the organizer’s language, %s', async (other) => {
ship('organizer', ['en', other]);
request.session.locale = other;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import type { OwnLines } from '@/lib/organizer-errors';

/**
* Connected apps' own lines for the `?error=` its Disconnect sends back,
* which the page passes to `refusalFromQuery`: a disconnect that failed for a
* reason the page can't name says so. Every other code gets the line every
* screen gives it. A function of its own, so the test that reads every
* organizer refusal through a stand-in translator
* (src/lib/organizer-reasons.test.ts) calls the page's own words, and English
* written in here fails it.
* which the page passes to `refusalFromQuery`: an app that is no longer
* there (`not_found`) was disconnected already, from another tab say, since
* the page loaded, and a disconnect that failed for a reason the page can't
* name says so. Every other code gets the line every screen gives it. A
* function of its own, so the test that reads every organizer refusal
* through a stand-in translator (src/lib/organizer-reasons.test.ts) calls the
* page's own words, and English written in here fails it.
*/
export function connectedAppsLines(errors: Translator<'organizer.errors'>): OwnLines {
return { internal: errors('disconnectFailed') };
return { not_found: errors('alreadyDisconnected'), internal: errors('disconnectFailed') };
}
3 changes: 2 additions & 1 deletion src/i18n/translated-from/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@
"organizer.errors.code.internal": "Save failed.",
"organizer.errors.titleTooShort": "Title must be at least {min, number, ::group-off} characters.",
"organizer.errors.tooManySignups": "You’ve created a lot of signups in the last hour. Try again in about {minutes, plural, one {{minutes, number, ::group-off} minute} other {{minutes, number, ::group-off} minutes}}.",
"organizer.errors.disconnectFailed": "Could not disconnect. Try again.",
"organizer.errors.disconnectFailed": "Couldn’t disconnect. Try again.",
"organizer.errors.alreadyDisconnected": "That app is already disconnected.",
"organizer.signupSettings.signupForm.title": "Sign-up form",
"organizer.signupSettings.signupForm.askForEmail": "Ask for an email address",
"organizer.signupSettings.signupForm.required": "Required",
Expand Down
8 changes: 5 additions & 3 deletions src/lib/organizer-errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, expectTypeOf, it } from 'vitest';
import { connectedAppsLines } from '@/app/(organizer)/app/(chrome)/settings/connected-apps/refusal-lines';
import { CATALOG_LOCALES } from '@/i18n/config';
import { getStandInTranslator, getTestTranslator } from '@/i18n/testing/translator';
import { serviceError, type ErrorCode, type ErrorReason } from './errors';
Expand Down Expand Up @@ -94,12 +95,13 @@ describe('refusalFromQuery', () => {
});

it('gives a screen’s own line for a code, as Connected apps does for a failed disconnect', () => {
const own = { internal: t('disconnectFailed') };
expect(refusalFromQuery(t, 'internal', own)).toBe('Could not disconnect. Try again.');
const own = connectedAppsLines(t);
expect(refusalFromQuery(t, 'internal', own)).toBe('Couldn’t disconnect. Try again.');
// An app already disconnected, in another tab: the server's message was
// "no such connected app".
expect(refusalFromQuery(t, 'not_found', own)).toBe('No longer available.');
expect(refusalFromQuery(t, 'not_found', own)).toBe('That app is already disconnected.');
expect(refusalFromQuery(t, 'forbidden', own)).toBe('You don’t have edit access.');
expect(refusalFromQuery(t, 'rate_limited', own)).toBe(t('code.rate_limited'));
});

it('shows nothing for anything else, so a link can’t put words on the page', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/messages/en.d.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ declare const messages: {
},
"titleTooShort": "Title must be at least {min, number, ::group-off} characters.",
"tooManySignups": "You’ve created a lot of signups in the last hour. Try again in about {minutes, plural, one {{minutes, number, ::group-off} minute} other {{minutes, number, ::group-off} minutes}}.",
"disconnectFailed": "Could not disconnect. Try again."
"disconnectFailed": "Couldn’t disconnect. Try again.",
"alreadyDisconnected": "That app is already disconnected."
},
"signupSettings": {
"signupForm": {
Expand Down
3 changes: 2 additions & 1 deletion src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@
},
"titleTooShort": "Title must be at least {min, number, ::group-off} characters.",
"tooManySignups": "You’ve created a lot of signups in the last hour. Try again in about {minutes, plural, one {{minutes, number, ::group-off} minute} other {{minutes, number, ::group-off} minutes}}.",
"disconnectFailed": "Could not disconnect. Try again."
"disconnectFailed": "Couldn’t disconnect. Try again.",
"alreadyDisconnected": "That app is already disconnected."
},
"signupSettings": {
"signupForm": {
Expand Down
3 changes: 2 additions & 1 deletion src/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@
},
"titleTooShort": "Titeln måste ha minst {min, number} tecken.",
"tooManySignups": "Du har skapat många anmälningslistor den senaste timmen. Försök igen om ungefär {minutes, plural, one {{minutes, number} minut} other {{minutes, number} minuter}}.",
"disconnectFailed": "Det gick inte att koppla från. Försök igen."
"disconnectFailed": "Det gick inte att koppla från. Försök igen.",
"alreadyDisconnected": "Appen är redan frånkopplad."
},
"signupSettings": {
"signupForm": {
Expand Down
Loading