From a6e38ad2ae7b075d539fd4d1d8f7e6d5273024ed Mon Sep 17 00:00:00 2001
From: Matiss Janis Aboltins <matiss@mja.lv>
Date: Mon, 22 Jan 2024 08:34:40 +0000
Subject: [PATCH] :sparkles: allow un-reconciling (unlocking) transactions
 (#2252)

---
 .../src/components/modals/ConfirmTransactionEdit.tsx   |  6 ++++++
 .../src/components/transactions/TransactionsTable.jsx  | 10 ++++++++++
 upcoming-release-notes/2252.md                         |  6 ++++++
 3 files changed, 22 insertions(+)
 create mode 100644 upcoming-release-notes/2252.md

diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
index 15cd79a23..daacc7793 100644
--- a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
+++ b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
@@ -42,6 +42,12 @@ export function ConfirmTransactionEdit({
               Saving your changes to this reconciled transaction may bring your
               reconciliation out of balance.
             </Block>
+          ) : confirmReason === 'unlockReconciled' ? (
+            <Block>
+              Unlocking this transaction means you won‘t be warned about changes
+              that can impact your reconciled balance. (Changes to amount,
+              account, payee, etc).
+            </Block>
           ) : confirmReason === 'deleteReconciled' ? (
             <Block>
               Deleting this reconciled transaction may bring your reconciliation
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
index 2e3291b86..69e53337c 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
@@ -773,6 +773,16 @@ const Transaction = memo(function Transaction(props) {
         onUpdateAfterConfirm(name, value);
       }
     }
+
+    // Allow un-reconciling (unlocking) transactions
+    if (name === 'cleared' && transaction.reconciled) {
+      props.pushModal('confirm-transaction-edit', {
+        onConfirm: () => {
+          onUpdateAfterConfirm('reconciled', false);
+        },
+        confirmReason: 'unlockReconciled',
+      });
+    }
   }
 
   function onUpdateAfterConfirm(name, value) {
diff --git a/upcoming-release-notes/2252.md b/upcoming-release-notes/2252.md
new file mode 100644
index 000000000..55ae4bea2
--- /dev/null
+++ b/upcoming-release-notes/2252.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [MatissJanis]
+---
+
+Allow un-reconcile (unlock) transactions by clicking on the lock icon
-- 
GitLab