Skip to content
Merged
2 changes: 1 addition & 1 deletion .agent-marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"category": "productivity",
"source": "./plugins/linear",
"version": "1.5.2"
"version": "1.5.3"
},
{
"name": "notion",
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/app/api/github/install/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { organizationSyncsNow } from "@superset/trpc/sync-policy";
import { env } from "@/env";
import { beginOAuthFlow, STATE_COOKIES } from "@/lib/integrations/oauthFlow";
import { requireOrgMember } from "@/lib/integrations/requireOrgMember";
Expand All @@ -6,6 +7,10 @@ export async function GET(request: Request) {
const member = await requireOrgMember(request);
if (member instanceof Response) return member;

if (!(await organizationSyncsNow(member.organizationId))) {
return Response.redirect(`${env.NEXT_PUBLIC_WEB_URL}/settings/billing`);
}

if (!env.GH_APP_ID) {
return Response.json(
{ error: "GitHub App not configured" },
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/app/api/integrations/jobs/suspend/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async function linearPass(deadline: number) {
.where(
and(
eq(connections.connector, "linear"),
eq(connections.authMethod, "oauth2"),
isNull(connections.disconnectedAt),
not(organizationSyncs(connections.organizationId)),
),
Expand Down
7 changes: 6 additions & 1 deletion apps/api/src/app/api/integrations/linear/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export async function GET(request: Request) {
user: { id: viewer.id, label: viewer.displayName },
},
});
if (result.conflict) return fail("workspace_already_linked");
if (result.conflict) {
const owner = result.conflict.ownerEmail
? `&owner=${encodeURIComponent(result.conflict.ownerEmail)}`
: "";
return exit(`${settingsUrl}?error=workspace_already_linked${owner}`);
}

// The person who connected is the one Linear account we know for certain
// belongs to a Superset user, so link it. Linear user ids are scoped to
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/app/api/integrations/linear/connect/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { organizationSyncsNow } from "@superset/trpc/sync-policy";
import { env } from "@/env";
import { beginOAuthFlow, STATE_COOKIES } from "@/lib/integrations/oauthFlow";
import { requireOrgMember } from "@/lib/integrations/requireOrgMember";
Expand All @@ -6,6 +7,10 @@ export async function GET(request: Request) {
const member = await requireOrgMember(request);
if (member instanceof Response) return member;

if (!(await organizationSyncsNow(member.organizationId))) {
return Response.redirect(`${env.NEXT_PUBLIC_WEB_URL}/settings/billing`);
}

return beginOAuthFlow({
cookie: STATE_COOKIES.linear,
payload: { organizationId: member.organizationId, userId: member.userId },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ type CallbackKeys = {
| "missing_params"
| "oauth_denied"
| "token_exchange_failed"
| "unauthorized";
| "unauthorized"
| "workspace_already_linked";
warning: "sync_queued_failed";
};
"microsoft-teams": {
Expand Down Expand Up @@ -147,30 +148,37 @@ export function IntegrationErrorHandler<P extends Provider>({
const success = searchParams.get("success");
if (!error && !warning && !success) return;

// Toast first: replacing the URL re-runs this effect through Next's
// patched history, and a deferred toast can be cleaned up before it shows.
if (error) {
const message = (messages as Record<string, CallbackMessage>)[error];
toast.error(resolveMessage(message, searchParams));
} else if (warning) {
toast.warning(
(warnings as Record<string, string> | undefined)?.[warning] ??
i18n._(
msg({
message: "Warning occurred.",
}),
),
);
} else if (success) {
toast.success(
(successes as Record<string, string> | undefined)?.[success] ??
i18n._(
msg({
message: "Success!",
}),
),
);
}
const show = () => {
const id = `integration-callback-${provider}`;
if (error) {
const message = (messages as Record<string, CallbackMessage>)[error];
toast.error(resolveMessage(message, searchParams), { id });
} else if (warning) {
toast.warning(
(warnings as Record<string, string> | undefined)?.[warning] ??
i18n._(
msg({
message: "Warning occurred.",
}),
),
{ id },
);
} else if (success) {
toast.success(
(successes as Record<string, string> | undefined)?.[success] ??
i18n._(
msg({
message: "Success!",
}),
),
{ id },
);
}
};
// The root layout's Toaster subscribes in its own effect, which runs after
// this one and drops anything published before it. Never cancelled: the
// replaceState below re-runs this effect, and its cleanup would drop the toast.
setTimeout(show, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: setTimeout(show, 0) is never cancelled, so show can publish a toast after this component has unmounted. The comment correctly explains that a cleanup clearing the timer would drop the toast on the replaceState-induced effect re-run, but it doesn't cover the unmount case: if this component unmounts before the timer fires (e.g., a client-side redirect right after the callback lands), the toast still appears on whatever route mounts next. In dev StrictMode the effect also double-runs and schedules two timers (masked today only by the shared toast id). Guard show with a ref that tracks mounted: set it true at the top of the effect (so the post-replaceState re-run re-arms it before the timer fires) and false in a cleanup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/web/src/app/(app)/(page)/integrations/components/IntegrationErrorHandler/IntegrationErrorHandler.tsx, line 181:

<comment>`setTimeout(show, 0)` is never cancelled, so `show` can publish a toast after this component has unmounted. The comment correctly explains that a cleanup clearing the timer would drop the toast on the replaceState-induced effect re-run, but it doesn't cover the unmount case: if this component unmounts before the timer fires (e.g., a client-side redirect right after the callback lands), the toast still appears on whatever route mounts next. In dev StrictMode the effect also double-runs and schedules two timers (masked today only by the shared toast id). Guard `show` with a ref that tracks mounted: set it true at the top of the effect (so the post-replaceState re-run re-arms it before the timer fires) and false in a cleanup.</comment>

<file context>
@@ -147,30 +148,37 @@ export function IntegrationErrorHandler<P extends Provider>({
+		// The root layout's Toaster subscribes in its own effect, which runs after
+		// this one and drops anything published before it. Never cancelled: the
+		// replaceState below re-runs this effect, and its cleanup would drop the toast.
+		setTimeout(show, 0);
 		window.history.replaceState({}, "", `/integrations/${provider}`);
 	}, [searchParams, provider, messages, warnings, successes]);
</file context>

window.history.replaceState({}, "", `/integrations/${provider}`);
}, [searchParams, provider, messages, warnings, successes]);

Expand Down
16 changes: 16 additions & 0 deletions apps/web/src/app/(app)/(page)/integrations/linear/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ export default async function LinearIntegrationPage() {
message: "You are not authorized to perform this action.",
}),
),
workspace_already_linked: {
param: "owner",
withParam: i18n._({
...msg({
message:
"This Linear workspace is already connected by {owner}. Ask them to disconnect first.",
}),
values: { owner: "{owner}" },
}),
withoutParam: i18n._(
msg({
message:
"This Linear workspace is already connected by another Superset organization.",
}),
),
},
};
const CALLBACK_WARNINGS = {
sync_queued_failed: i18n._(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ export default async function MicrosoftTeamsIntegrationPage() {
),
tenant_already_linked: {
param: "detail",
withParam: i18n._(
msg({
withParam: i18n._({
...msg({
message:
"This Microsoft tenant is already connected by {detail}. Ask them to disconnect first.",
}),
),
values: { detail: "{detail}" },
}),
withoutParam: i18n._(
msg({
message:
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/app/(app)/(page)/integrations/slack/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ export default async function SlackIntegrationPage() {
),
workspace_already_linked: {
param: "owner",
withParam: i18n._(
msg({
withParam: i18n._({
...msg({
message:
"This Slack workspace is already connected by {owner}. Ask them to disconnect first.",
}),
),
values: { owner: "{owner}" },
}),
withoutParam: i18n._(
msg({
message:
Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/cs/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Trvá to déle než obvykle. Pracovní prostor už možná je připraven
msgid "This issue link is invalid."
msgstr "Tento odkaz na issue je neplatný."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Tento Linear workspace už připojil {owner}. Požádejte je, ať ho nejdřív odpojí."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This wording says the workspace connected {owner}, reversing who connected whom. Use a passive construction so the message correctly identifies the workspace as connected under the owner’s account.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/i18n/locales/cs/messages.po, line 16074:

<comment>This wording says the workspace connected `{owner}`, reversing who connected whom. Use a passive construction so the message correctly identifies the workspace as connected under the owner’s account.</comment>

<file context>
@@ -16070,6 +16070,12 @@ msgstr "Trvá to déle než obvykle. Pracovní prostor už možná je připraven
 msgstr "Tento odkaz na issue je neplatný."
 
+msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
+msgstr "Tento Linear workspace už připojil {owner}. Požádejte je, ať ho nejdřív odpojí."
+
+msgid "This Linear workspace is already connected by another Superset organization."
</file context>
Suggested change
msgstr "Tento Linear workspace už připojil {owner}. Požádejte je, ať ho nejdřív odpojí."
msgstr "Tento Linear workspace už je připojený pod účtem {owner}. Požádejte je, ať ho nejdřív odpojí."


msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Tento Linear workspace už připojila jiná organizace Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Vypadá to na binární soubor. Otevření jako text může zobrazit nesmyslný výstup nebo u velkých souborů zamrznout editor."

Expand Down
12 changes: 9 additions & 3 deletions packages/i18n/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -15999,7 +15999,7 @@ msgid "Thirty"
msgstr "Dreißig"

msgid "This {plugin} account is already connected by {owner}. Ask them to disconnect first."
msgstr "Das {plugin}-Konto ist bereits von {owner} verbunden. Bitte sie oder ihn, es zuerst zu trennen."
msgstr "Das {plugin}-Konto wurde bereits von {owner} verbunden. Bitte sie oder ihn, es zuerst zu trennen."

msgid "This {plugin} account is already connected by another Superset organization."
msgstr "Dieses {plugin}-Konto ist bereits mit einer anderen Superset-Organisation verbunden."
Expand Down Expand Up @@ -16119,14 +16119,20 @@ msgstr "Das dauert länger als sonst. Der Arbeitsbereich ist womöglich schon be
msgid "This issue link is invalid."
msgstr "Dieser Issue-Link ist ungültig."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Dieser Linear-Workspace wurde bereits von {owner} verbunden. Bitte diese Person, die Verbindung zuerst zu trennen."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Dieser Linear-Workspace ist bereits mit einer anderen Superset-Organisation verbunden."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Das sieht nach einer Binärdatei aus. Sie als Text zu öffnen, kann zu Zeichensalat führen oder den Editor bei großen Dateien einfrieren."

msgid "This Mac"
msgstr "Dieser Mac"

msgid "This Microsoft tenant is already connected by {detail}. Ask them to disconnect first."
msgstr "Dieser Microsoft-Tenant ist bereits von {detail} verbunden. Bitte diese Person, die Verbindung zuerst zu trennen."
msgstr "Dieser Microsoft-Tenant wurde bereits von {detail} verbunden. Bitte diese Person, die Verbindung zuerst zu trennen."

msgid "This Microsoft tenant is already connected by another Superset organization."
msgstr "Dieser Microsoft-Tenant ist bereits mit einer anderen Superset-Organisation verbunden."
Expand Down Expand Up @@ -16219,7 +16225,7 @@ msgid "This screen doesn't exist"
msgstr "Diesen Bildschirm gibt es nicht"

msgid "This Slack workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Dieser Slack-Workspace ist bereits von {owner} verbunden. Bitte diese Person, die Verbindung zuerst zu trennen."
msgstr "Dieser Slack-Workspace wurde bereits von {owner} verbunden. Bitte diese Person, die Verbindung zuerst zu trennen."

msgid "This Slack workspace is already connected by another Superset organization."
msgstr "Dieser Slack-Workspace ist bereits mit einer anderen Superset-Organisation verbunden."
Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "This is taking longer than usual. The workspace may already be ready —
msgid "This issue link is invalid."
msgstr "This issue link is invalid."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "This Linear workspace is already connected by {owner}. Ask them to disconnect first."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "This Linear workspace is already connected by another Superset organization."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Está tardando más de lo normal. Puede que el espacio de trabajo ya est
msgid "This issue link is invalid."
msgstr "Este enlace de issue no es válido."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Este espacio de trabajo de Linear ya está conectado por {owner}. Pídele que lo desconecte primero."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Este espacio de trabajo de Linear ya está conectado por otra organización de Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Esto parece un archivo binario. Abrirlo como texto puede mostrar caracteres ilegibles o congelar el editor si es grande."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Cela prend plus de temps que d'habitude. L'espace de travail est peut-ê
msgid "This issue link is invalid."
msgstr "Ce lien d'issue est invalide."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Cet espace de travail Linear est déjà connecté par {owner}. Demandez-lui de le déconnecter d'abord."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Cet espace de travail Linear est déjà connecté par une autre organisation Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Ce fichier semble binaire. L'ouvrir comme du texte peut afficher une sortie illisible ou figer l'éditeur pour les gros fichiers."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/id/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Ini lebih lama dari biasanya. Workspace-nya mungkin sudah siap — memua
msgid "This issue link is invalid."
msgstr "Tautan issue ini tidak valid."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Workspace Linear ini sudah terhubung oleh {owner}. Minta mereka memutuskannya dulu."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Workspace Linear ini sudah terhubung oleh organisasi Superset lain."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Ini tampak seperti file biner. Membukanya sebagai teks bisa menampilkan output kacau atau membekukan editor untuk file besar."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/it/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Ci sta mettendo più del solito. Il workspace potrebbe essere già pront
msgid "This issue link is invalid."
msgstr "Questo link alla issue non è valido."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Questo workspace Linear è già collegato da {owner}. Chiedi di scollegarlo prima."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Questo workspace Linear è già collegato da un'altra organizzazione Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Sembra un file binario. Aprirlo come testo può mostrare output illeggibile o bloccare l'editor con file grandi."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/ja/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "通常より時間がかかっています。ワークスペースはす
msgid "This issue link is invalid."
msgstr "このissueリンクは無効です。"

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "このLinearワークスペースは{owner}がすでに接続しています。先に接続を解除してもらってください。"

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "このLinearワークスペースは別のSuperset組織がすでに接続しています。"

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "バイナリファイルのようです。テキストとして開くと文字化けしたり、大きなファイルではエディタが固まる可能性があります。"

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/ko/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "평소보다 오래 걸리고 있습니다. 워크스페이스가 이미
msgid "This issue link is invalid."
msgstr "이 이슈 링크가 올바르지 않습니다."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "이 Linear 워크스페이스는 이미 {owner}이(가) 연결했습니다. 먼저 연결을 해제해 달라고 요청하세요."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "이 Linear 워크스페이스는 이미 다른 Superset 조직이 연결했습니다."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "바이너리 파일로 보입니다. 텍스트로 열면 깨진 내용이 표시되거나, 파일이 크면 에디터가 멈출 수 있습니다."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/nl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Dit duurt langer dan gewoonlijk. De werkruimte is mogelijk al klaar —
msgid "This issue link is invalid."
msgstr "Deze link naar een issue is ongeldig."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Deze Linear-werkruimte is al gekoppeld door {owner}. Vraag hen om eerst los te koppelen."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Deze Linear-werkruimte is al gekoppeld door een andere Superset-organisatie."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Dit lijkt een binair bestand. Als tekst openen kan onleesbare uitvoer geven of de editor bij grote bestanden laten vastlopen."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/pl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Trwa to dłużej niż zwykle. Obszar roboczy może już być gotowy —
msgid "This issue link is invalid."
msgstr "Ten link do zgłoszenia jest nieprawidłowy."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Ten obszar roboczy Lineara jest już połączony przez {owner}. Poproś o rozłączenie."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Ten obszar roboczy Lineara jest już połączony z inną organizacją Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "To wygląda na plik binarny. Otwarcie go jako tekst może pokazać śmieci albo zawiesić edytor przy dużych plikach."

Expand Down
6 changes: 6 additions & 0 deletions packages/i18n/locales/pt-BR/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16119,6 +16119,12 @@ msgstr "Está demorando mais que o normal. A área de trabalho pode já estar pr
msgid "This issue link is invalid."
msgstr "Este link de issue é inválido."

msgid "This Linear workspace is already connected by {owner}. Ask them to disconnect first."
msgstr "Este workspace do Linear já está conectado por {owner}. Peça para essa pessoa desconectar primeiro."

msgid "This Linear workspace is already connected by another Superset organization."
msgstr "Este workspace do Linear já está conectado a outra organização do Superset."

msgid "This looks like a binary file. Opening it as text may show garbled output or freeze the editor for large files."
msgstr "Isto parece ser um arquivo binário. Abri-lo como texto pode mostrar caracteres estranhos ou travar o editor em arquivos grandes."

Expand Down
Loading
Loading