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

🐛 (goCardless) patch incomplete migration #2308

Merged
merged 3 commits into from
Feb 1, 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
15 changes: 11 additions & 4 deletions packages/desktop-client/src/components/accounts/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ export function AccountHeader({
const [menuOpen, setMenuOpen] = useState(false);
const searchInput = useRef(null);
const splitsExpanded = useSplitsExpanded();
const syncServerStatus = useSyncServerStatus();
const isUsingServer = syncServerStatus !== 'no-server';
const isServerOffline = syncServerStatus === 'offline';

let canSync = account && account.account_id;
let canSync = account && account.account_id && isUsingServer;
if (!account) {
// All accounts - check for any syncable account
canSync = !!accounts.find(account => !!account.account_id);
canSync = !!accounts.find(account => !!account.account_id) && isUsingServer;
}

function onToggleSplits() {
Expand Down Expand Up @@ -210,7 +213,11 @@ export function AccountHeader({
style={{ marginTop: 12 }}
>
{((account && !account.closed) || canSync) && (
<Button type="bare" onClick={canSync ? onSync : onImport}>
<Button
type="bare"
onClick={canSync ? onSync : onImport}
disabled={canSync && isServerOffline}
>
{canSync ? (
<>
<AnimatedRefresh
Expand All @@ -222,7 +229,7 @@ export function AccountHeader({
}
style={{ marginRight: 4 }}
/>{' '}
Sync
{isServerOffline ? 'Sync offline' : 'Sync'}
</>
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ BEGIN TRANSACTION;

ALTER TABLE accounts ADD COLUMN account_sync_source TEXT;

UPDATE accounts SET
account_sync_source = CASE
WHEN account_id THEN 'goCardless'
ELSE NULL
END;

COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BEGIN TRANSACTION;

UPDATE accounts
SET
account_sync_source = 'goCardless'
WHERE account_id IS NOT NULL
AND account_sync_source IS NULL;

COMMIT;
6 changes: 6 additions & 0 deletions upcoming-release-notes/2308.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

Fix GoCardless bank sync breaking after a flaky SimpleFin db migration.
Loading