From c8298fe3b5045bbb065f3fb7f41a94256ba7a9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=9F=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=BD=D1=8F=D0=BA=D0=BE=D0=B2?= Date: Wed, 31 Aug 2022 13:00:38 +0300 Subject: [PATCH] Fix hash field for watchlist notifications --- apps/explorer/lib/explorer/account/notifier/notify.ex | 7 ++++++- .../lib/explorer/account/watchlist_notification.ex | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/explorer/lib/explorer/account/notifier/notify.ex b/apps/explorer/lib/explorer/account/notifier/notify.ex index bfbcb6326d..b64b4bd47a 100644 --- a/apps/explorer/lib/explorer/account/notifier/notify.ex +++ b/apps/explorer/lib/explorer/account/notifier/notify.ex @@ -11,6 +11,7 @@ defmodule Explorer.Account.Notifier.Notify do require Logger import Ecto.Query, only: [from: 2] + import Explorer.Chain, only: [hash_to_lower_case_string: 1] def call(nil), do: nil def call([]), do: nil @@ -123,7 +124,11 @@ defmodule Explorer.Account.Notifier.Notify do subject: summary.subject, tx_fee: summary.tx_fee, name: summary.name, - type: summary.type + type: summary.type, + from_address_hash_hash: hash_to_lower_case_string(summary.from_address_hash), + to_address_hash_hash: hash_to_lower_case_string(summary.to_address_hash), + transaction_hash_hash: hash_to_lower_case_string(summary.transaction_hash), + subject_hash: summary.subject } end end diff --git a/apps/explorer/lib/explorer/account/watchlist_notification.ex b/apps/explorer/lib/explorer/account/watchlist_notification.ex index d95c915ed8..6c909be3ed 100644 --- a/apps/explorer/lib/explorer/account/watchlist_notification.ex +++ b/apps/explorer/lib/explorer/account/watchlist_notification.ex @@ -7,6 +7,7 @@ defmodule Explorer.Account.WatchlistNotification do use Explorer.Schema import Ecto.Changeset + import Explorer.Chain, only: [hash_to_lower_case_string: 1] alias Explorer.Account.WatchlistAddress @@ -56,9 +57,9 @@ defmodule Explorer.Account.WatchlistNotification do defp put_hashed_fields(changeset) do changeset - |> put_change(:from_address_hash_hash, get_field(changeset, :from_address_hash)) - |> put_change(:to_address_hash_hash, get_field(changeset, :to_address_hash)) - |> put_change(:transaction_hash_hash, get_field(changeset, :transaction_hash)) + |> put_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash))) + |> put_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash))) + |> put_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash))) |> put_change(:subject_hash, get_field(changeset, :subject)) end end