Skip to content

Commit

Permalink
upgrade to phx 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
zven21 committed Nov 29, 2018
1 parent 11caf53 commit a6adf27
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 50 deletions.
2 changes: 1 addition & 1 deletion lib/mipha_web/channels/user_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule MiphaWeb.UserSocket do
channel("topic:*", MiphaWeb.TopicChannel)

## Transports
transport(:websocket, Phoenix.Transports.WebSocket, timeout: 45_000)
# transport(:websocket, Phoenix.Transports.WebSocket, timeout: 45_000)
# transport :longpoll, Phoenix.Transports.LongPoll

# Socket params are passed from the client and can
Expand Down
4 changes: 2 additions & 2 deletions lib/mipha_web/controllers/user_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ defmodule MiphaWeb.UserController do
end

def index(conn, params) do
users = Accounts.Queries.list_users() |> Turbo.Ecto.search(params)
result = Accounts.Queries.list_users() |> Turbo.Ecto.turbo(params)
user_count = Accounts.get_user_count()

render(conn, :index,
users: users,
users: result.datas,
user_count: user_count
)
end
Expand Down
5 changes: 4 additions & 1 deletion lib/mipha_web/endpoint.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
defmodule MiphaWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :mipha

socket("/socket", MiphaWeb.UserSocket)
socket "/socket", MiphaWeb.UserSocket,
# or list of options
websocket: true,
longpoll: false

# Serve at "/" the static files from "priv/static" directory.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mipha_web/templates/shared/_pagination.html.eex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= if @paginate.total_pages > 1 do %>
<div class="pagination">
<%= turbo_pagination_links decorator_paginate(@conn, @paginate) %>
<%= turbo_pagination_links(@conn, @paginate) %>
</div>
<% end %>
21 changes: 11 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,40 @@ defmodule Mipha.Mixfile do
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.3.3"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:phoenix, "~> 1.4.0"},
{:phoenix_pubsub, "~> 1.1"},
{:phoenix_ecto, "~> 4.0"},
{:ecto_sql, "~> 3.0"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:credo, "~> 0.10.0", only: [:dev, :test], runtime: false},
{:credo, "~> 0.10.2", only: [:dev, :test], runtime: false},
{:comeonin, "~> 4.1"},
{:bcrypt_elixir, "~> 1.0"},
{:ueberauth, "~> 0.5.0"},
{:ueberauth_identity, "~> 0.2.3"},
{:ueberauth_github, "~> 0.7.0"},
{:faker, "~> 0.10.0"},
{:earmark, "~> 1.2"},
{:earmark, "~> 1.3.0"},
{:html_sanitize_ex, "~> 1.3"},
{:timex, "~> 3.3"},
{:ecto_enum, "~> 1.1"},
{:qiniu, "~> 0.4.0"},
{:exmoji, "~> 0.2.2"},
{:bamboo, "~> 1.0"},
{:bamboo_smtp, "~> 1.5"},
{:ecto_enum, "~> 1.1"},
{:cachex, "~> 3.0"},
{:cachex, "~> 3.1.1"},
{:jason, "~> 1.1"},
{:poison, "~> 3.0", override: true},
{:captcha, github: "zven21/elixir-captcha"},
{:turbo_ecto, "0.1.6"},
{:turbo_html, "0.1.4"},
{:turbo_ecto, github: "zven21/turbo_ecto"},
{:turbo_html, github: "zven21/turbo_html"},
{:remote_ip, "~> 0.1.4"},
{:plug_attack, "~> 0.3.1"},
{:sentry, "~> 6.4"},
{:ex_machina, "~> 2.2"},
{:ex_machina, "~> 2.2.2"},
{:excoveralls, "~> 0.10", only: :test}
]
end
Expand Down
62 changes: 33 additions & 29 deletions mix.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/mipha/topics/topics_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ defmodule Mipha.TopicsTest do
test "create_topic/1 with valid data creates a topic" do
assert {:ok, %Topic{} = topic} = Topics.create_topic(@valid_attrs)
assert topic.body == "some body"
assert topic.closed_at == ~N[2010-04-17 14:00:00.000000]
assert topic.closed_at == ~N[2010-04-17 14:00:00]
assert topic.last_reply_id == 42
assert topic.last_reply_user_id == 42
assert topic.node_id == 42
assert topic.replied_at == ~N[2010-04-17 14:00:00.000000]
assert topic.replied_at == ~N[2010-04-17 14:00:00]
assert topic.reply_count == 42
assert topic.suggested_at == ~N[2010-04-17 14:00:00.000000]
assert topic.suggested_at == ~N[2010-04-17 14:00:00]
assert topic.title == "some title"
assert topic.user_id == 42
assert topic.visit_count == 42
Expand All @@ -97,13 +97,13 @@ defmodule Mipha.TopicsTest do
assert {:ok, topic} = Topics.update_topic(topic, @update_attrs)
assert %Topic{} = topic
assert topic.body == "some updated body"
assert topic.closed_at == ~N[2011-05-18 15:01:01.000000]
assert topic.closed_at == ~N[2011-05-18 15:01:01]
assert topic.last_reply_id == 43
assert topic.last_reply_user_id == 43
assert topic.node_id == 43
assert topic.replied_at == ~N[2011-05-18 15:01:01.000000]
assert topic.replied_at == ~N[2011-05-18 15:01:01]
assert topic.reply_count == 43
assert topic.suggested_at == ~N[2011-05-18 15:01:01.000000]
assert topic.suggested_at == ~N[2011-05-18 15:01:01]
assert topic.title == "some updated title"
assert topic.user_id == 43
assert topic.visit_count == 43
Expand Down

0 comments on commit a6adf27

Please sign in to comment.