From 5af6dfa7e2fdee1348f8f8651ce0a16688e2243b Mon Sep 17 00:00:00 2001 From: Stamates Date: Fri, 28 Sep 2018 15:23:10 -0400 Subject: [PATCH] Fix issue with channel connection on transactions --- apps/block_scout_web/assets/js/pages/transaction.js | 4 ++-- .../block_scout_web/channels/transaction_channel.ex | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/block_scout_web/assets/js/pages/transaction.js b/apps/block_scout_web/assets/js/pages/transaction.js index 5011192c82..0c91a7cc5e 100644 --- a/apps/block_scout_web/assets/js/pages/transaction.js +++ b/apps/block_scout_web/assets/js/pages/transaction.js @@ -153,7 +153,7 @@ if ($transactionPendingListPage.length) { const pendingTransactionsChannel = socket.channel(`transactions:new_pending_transaction`) pendingTransactionsChannel.join() pendingTransactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) - pendingTransactionsChannel.on('new_pending_transaction', batchChannel((msgs) => + pendingTransactionsChannel.on('pending_transaction', batchChannel((msgs) => store.dispatch({ type: 'RECEIVED_NEW_PENDING_TRANSACTION_BATCH', msgs: humps.camelizeKeys(msgs) })) ) }, @@ -215,7 +215,7 @@ if ($transactionListPage.length) { const transactionsChannel = socket.channel(`transactions:new_transaction`) transactionsChannel.join() transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' })) - transactionsChannel.on('new_transaction', batchChannel((msgs) => + transactionsChannel.on('transaction', batchChannel((msgs) => store.dispatch({ type: 'RECEIVED_NEW_TRANSACTION_BATCH', msgs: humps.camelizeKeys(msgs) })) ) }, diff --git a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex index 0d9dc07e01..e5ce03b86f 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex @@ -8,7 +8,7 @@ defmodule BlockScoutWeb.TransactionChannel do alias Explorer.Chain.Hash alias Phoenix.View - intercept(["new_pending_transaction", "new_transaction"]) + intercept(["pending_transaction", "transaction"]) def join("transactions:new_transaction", _params, socket) do {:ok, %{}, socket} @@ -22,7 +22,7 @@ defmodule BlockScoutWeb.TransactionChannel do {:ok, %{}, socket} end - def handle_out("new_pending_transaction", %{transaction: transaction}, socket) do + def handle_out("pending_transaction", %{transaction: transaction}, socket) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_transaction = @@ -32,7 +32,7 @@ defmodule BlockScoutWeb.TransactionChannel do transaction: transaction ) - push(socket, "new_pending_transaction", %{ + push(socket, "pending_transaction", %{ transaction_hash: Hash.to_string(transaction.hash), transaction_html: rendered_transaction }) @@ -40,7 +40,7 @@ defmodule BlockScoutWeb.TransactionChannel do {:noreply, socket} end - def handle_out("new_transaction", %{transaction: transaction}, socket) do + def handle_out("transaction", %{transaction: transaction}, socket) do Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_transaction = @@ -50,7 +50,7 @@ defmodule BlockScoutWeb.TransactionChannel do transaction: transaction ) - push(socket, "new_transaction", %{ + push(socket, "transaction", %{ transaction_hash: Hash.to_string(transaction.hash), transaction_html: rendered_transaction })