Skip to content

Commit

Permalink
fix: faulty block_scout_web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev committed May 29, 2024
1 parent e3fc307 commit 833eab6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/custom_abi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ defmodule Explorer.Account.CustomABI do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
|> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
end

defp check_smart_contract_address(%Changeset{changes: %{address_hash: address_hash}} = custom_abi) do
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/identity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ defmodule Explorer.Account.Identity do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> put_change(:uid_hash, get_field(changeset, :uid))
|> force_change(:uid_hash, get_field(changeset, :uid))
end
end
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/tag_address.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ defmodule Explorer.Account.TagAddress do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
|> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
end

defp check_existence_or_create_address(%Changeset{changes: %{address_hash: address_hash}, valid?: true} = changeset) do
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/tag_transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ defmodule Explorer.Account.TagTransaction do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> put_change(:tx_hash_hash, hash_to_lower_case_string(get_field(changeset, :tx_hash)))
|> force_change(:tx_hash_hash, hash_to_lower_case_string(get_field(changeset, :tx_hash)))
end

defp check_transaction_existence(%Changeset{changes: %{tx_hash: tx_hash}} = changeset) do
Expand Down
3 changes: 2 additions & 1 deletion apps/explorer/lib/explorer/account/watchlist_address.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ defmodule Explorer.Account.WatchlistAddress do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> put_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
|> force_change(:address_hash_hash, hash_to_lower_case_string(get_field(changeset, :address_hash)))
end

def create(attrs) do
Expand Down
9 changes: 5 additions & 4 deletions apps/explorer/lib/explorer/account/watchlist_notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ defmodule Explorer.Account.WatchlistNotification do
end

defp put_hashed_fields(changeset) do
# Using force_change instead of put_change due to https://github.com/danielberkompas/cloak_ecto/issues/53
changeset
|> 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))
|> force_change(:from_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :from_address_hash)))
|> force_change(:to_address_hash_hash, hash_to_lower_case_string(get_field(changeset, :to_address_hash)))
|> force_change(:transaction_hash_hash, hash_to_lower_case_string(get_field(changeset, :transaction_hash)))
|> force_change(:subject_hash, get_field(changeset, :subject))
end

@doc """
Expand Down

0 comments on commit 833eab6

Please sign in to comment.