fix(admin): surface clipboard copy failures instead of swallowing

Two admin paths previously had empty catch blocks around copyToClipboard:
the user-detail copy helper and AdminLandings handleCopyUrl. The adapter
already attempts the legacy execCommand fallback, so reaching the catch
means the operation truly failed — staying silent left admins thinking
their click worked when it hadn't.

Both now fire notify.error so the failure is visible.
This commit is contained in:
c0mrade
2026-05-26 13:48:10 +03:00
parent bc34e65aac
commit 576b4d5601
2 changed files with 8 additions and 2 deletions

View File

@@ -413,7 +413,9 @@ export default function AdminLandings() {
await copyToClipboard(url); await copyToClipboard(url);
notify.success(t('admin.landings.urlCopied')); notify.success(t('admin.landings.urlCopied'));
} catch { } catch {
// Clipboard write failed silently // The clipboard adapter already tries the legacy execCommand fallback;
// if we still failed, surface it so the admin doesn't think it worked.
notify.error(t('common.error'));
} }
}; };

View File

@@ -1261,7 +1261,11 @@ export default function AdminUserDetail() {
try { try {
await copyText(text); await copyText(text);
notify.success(t('admin.users.detail.copied')); notify.success(t('admin.users.detail.copied'));
} catch {} } catch {
// copy adapter already handles fallback + permission errors; surface
// the failure to the user instead of swallowing it silently.
notify.error(t('common.error'));
}
}; };
if (loading) { if (loading) {