Fix hash field for watchlist notifications

account
Никита Поздняков 2 years ago committed by Viktor Baranov
parent 4874d216e2
commit c8298fe3b5
  1. 7
      apps/explorer/lib/explorer/account/notifier/notify.ex
  2. 7
      apps/explorer/lib/explorer/account/watchlist_notification.ex

@ -11,6 +11,7 @@ defmodule Explorer.Account.Notifier.Notify do
require Logger require Logger
import Ecto.Query, only: [from: 2] import Ecto.Query, only: [from: 2]
import Explorer.Chain, only: [hash_to_lower_case_string: 1]
def call(nil), do: nil def call(nil), do: nil
def call([]), do: nil def call([]), do: nil
@ -123,7 +124,11 @@ defmodule Explorer.Account.Notifier.Notify do
subject: summary.subject, subject: summary.subject,
tx_fee: summary.tx_fee, tx_fee: summary.tx_fee,
name: summary.name, 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
end end

@ -7,6 +7,7 @@ defmodule Explorer.Account.WatchlistNotification do
use Explorer.Schema use Explorer.Schema
import Ecto.Changeset import Ecto.Changeset
import Explorer.Chain, only: [hash_to_lower_case_string: 1]
alias Explorer.Account.WatchlistAddress alias Explorer.Account.WatchlistAddress
@ -56,9 +57,9 @@ defmodule Explorer.Account.WatchlistNotification do
defp put_hashed_fields(changeset) do defp put_hashed_fields(changeset) do
changeset changeset
|> put_change(:from_address_hash_hash, get_field(changeset, :from_address_hash)) |> put_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash)))
|> put_change(:to_address_hash_hash, get_field(changeset, :to_address_hash)) |> put_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash)))
|> put_change(:transaction_hash_hash, get_field(changeset, :transaction_hash)) |> put_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash)))
|> put_change(:subject_hash, get_field(changeset, :subject)) |> put_change(:subject_hash, get_field(changeset, :subject))
end end
end end

Loading…
Cancel
Save