Copy public tags functionality to master

pull/6316/head
Никита Поздняков 2 years ago
parent 41305ad846
commit 6a127294a7
No known key found for this signature in database
GPG Key ID: F344106F9804FE5F
  1. 1
      CHANGELOG.md
  2. 6
      apps/block_scout_web/lib/block_scout_web/models/get_address_tags.ex
  3. 11
      apps/block_scout_web/lib/block_scout_web/models/get_transaction_tags.ex
  4. 3
      apps/block_scout_web/lib/block_scout_web/templates/address/_labels.html.eex
  5. 2
      apps/explorer/config/config.exs
  6. 1
      apps/explorer/lib/explorer/application.ex
  7. 1
      config/runtime.exs

@ -2,6 +2,7 @@
### Features
- [#6316](https://github.com/blockscout/blockscout/pull/6316) - Copy public tags functionality to master
- [#6196](https://github.com/blockscout/blockscout/pull/6196) - INDEXER_CATCHUP_BLOCKS_BATCH_SIZE and INDEXER_CATCHUP_BLOCKS_CONCURRENCY env varaibles
- [#6187](https://github.com/blockscout/blockscout/pull/6187) - Filter by created time of verified contracts in listcontracts API endpoint
- [#6092](https://github.com/blockscout/blockscout/pull/6092) - Blockscout Account functionality

@ -11,17 +11,17 @@ defmodule BlockScoutWeb.Models.GetAddressTags do
alias Explorer.Tags.{AddressTag, AddressToTag}
def get_address_tags(nil, nil),
do: %{personal_tags: [], watchlist_names: []}
do: %{common_tags: [], personal_tags: [], watchlist_names: []}
def get_address_tags(%Hash{} = address_hash, current_user) do
%{
# common_tags: get_tags_on_address(address_hash),
common_tags: get_tags_on_address(address_hash),
personal_tags: get_personal_tags(address_hash, current_user),
watchlist_names: get_watchlist_names_on_address(address_hash, current_user)
}
end
def get_address_tags(_, _), do: %{personal_tags: [], watchlist_names: []}
def get_address_tags(_, _), do: %{common_tags: [], personal_tags: [], watchlist_names: []}
def get_public_tags(%Hash{} = address_hash) do
%{

@ -3,7 +3,7 @@ defmodule BlockScoutWeb.Models.GetTransactionTags do
Get various types of tags associated with the transaction
"""
import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2]
import BlockScoutWeb.Models.GetAddressTags, only: [get_address_tags: 2, get_tags_on_address: 1]
alias Explorer.Account.TagTransaction
alias Explorer.Chain.Transaction
@ -18,7 +18,13 @@ defmodule BlockScoutWeb.Models.GetTransactionTags do
Map.put(addresses_tags, :personal_tx_tag, tx_tag)
end
def get_transaction_with_addresses_tags(_, _), do: %{personal_tags: [], watchlist_names: [], personal_tx_tag: nil}
def get_transaction_with_addresses_tags(%Transaction{} = transaction, _),
do: %{
common_tags: get_tags_on_address(transaction.to_address_hash),
personal_tags: [],
watchlist_names: [],
personal_tx_tag: nil
}
def get_transaction_tags(transaction_hash, %{id: identity_id}) do
Repo.account_repo().get_by(TagTransaction, tx_hash_hash: transaction_hash, identity_id: identity_id)
@ -34,6 +40,7 @@ defmodule BlockScoutWeb.Models.GetTransactionTags do
to_tags = get_address_tags(transaction.to_address_hash, %{id: identity_id, watchlist_id: watchlist_id})
%{
common_tags: get_tags_on_address(transaction.to_address_hash),
personal_tags: Enum.dedup(from_tags.personal_tags ++ to_tags.personal_tags),
watchlist_names: Enum.dedup(from_tags.watchlist_names ++ to_tags.watchlist_names)
}

@ -1,3 +1,6 @@
<%= for common_tag <- @tags.common_tags do %>
<%= render BlockScoutWeb.FormView, "_tag.html", text: common_tag.display_name, additional_classes: [tag_name_to_label(common_tag.label), "ml-1"] %>
<% end %>
<%= for personal_tag <- @tags.personal_tags do %>
<%= if personal_tag.address_hash do %>
<%= if personal_tag.label =~ "dark forest" do %>

@ -87,6 +87,8 @@ config :explorer, Explorer.Chain.Cache.GasUsage,
config :explorer, Explorer.Integrations.EctoLogger, query_time_ms_threshold: :timer.seconds(2)
config :explorer, Explorer.Tags.AddressTag.Cataloger, enabled: true
config :explorer, Explorer.Chain.Cache.MinMissingBlockNumber, enabled: System.get_env("DISABLE_WRITE_API") != "true"
config :explorer, Explorer.Repo, migration_timestamps: [type: :utc_datetime_usec]

@ -100,6 +100,7 @@ defmodule Explorer.Application do
configure(Explorer.Counters.AverageBlockTime),
configure(Explorer.Counters.Bridge),
configure(Explorer.Validator.MetadataProcessor),
configure(Explorer.Tags.AddressTag.Cataloger),
configure(MinMissingBlockNumber)
]
|> List.flatten()

@ -98,6 +98,7 @@ config :block_scout_web,
max_length_to_show_string_without_trimming: System.get_env("MAX_STRING_LENGTH_WITHOUT_TRIMMING", "2040"),
re_captcha_secret_key: System.get_env("RE_CAPTCHA_SECRET_KEY", nil),
re_captcha_client_key: System.get_env("RE_CAPTCHA_CLIENT_KEY", nil),
new_tags: System.get_env("NEW_TAGS"),
chain_id: System.get_env("CHAIN_ID"),
json_rpc: System.get_env("JSON_RPC"),
verification_max_libraries: verification_max_libraries

Loading…
Cancel
Save