diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 45d0de1..24e3607 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -89,6 +89,22 @@ def timespent end end + def sent_by + + respond_to do |format| + format.html { + @messages = Message.where(msgport_from: params[:msgport_from]).order(block_timestamp: :desc).page(params[:page]).per(25) + @messages_count = @messages.count + render :index + } + format.json { + @messages = Message.where(msgport_from: params[:msgport_from]).order(block_timestamp: :desc) + + render json: @messages + } + end + end + private # Use callbacks to share common setup or constraints between actions. diff --git a/config/routes.rb b/config/routes.rb index 8278730..b87d319 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,8 @@ get 'messages/timespent/:op/:number/:unit' => 'messages#timespent', as: :messages_timespent + get 'messages/sent_by/:msgport_from' => 'messages#sent_by' + get 'messages/:tx_or_hash' => 'messages#show', as: :message_by_tx_or_hash, constraints: { tx_or_hash: /0x[0-9a-fA-F]{64}/ }