[#114] User.Info: renamed `confirmation_update` to `confirmation_changeset`.
authorIvan Tashkinov <ivantashkinov@gmail.com>
Wed, 19 Dec 2018 13:27:16 +0000 (16:27 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Wed, 19 Dec 2018 13:31:03 +0000 (16:31 +0300)
lib/pleroma/user.ex
lib/pleroma/user/info.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex
test/web/oauth/oauth_controller_test.exs
test/web/twitter_api/twitter_api_controller_test.exs

index 41d01cbf5cf1dc87af9efcb8d057db3d4f2017f5..4e227b08d715f6aac0db9bcd61ac8163059b7ebb 100644 (file)
@@ -191,7 +191,7 @@ defmodule Pleroma.User do
       |> validate_format(:email, @email_regex)
       |> validate_length(:bio, max: 1000)
       |> validate_length(:name, min: 1, max: 100)
-      |> put_change(:info, User.Info.confirmation_change(%User.Info{}, confirmation_status))
+      |> put_change(:info, User.Info.confirmation_changeset(%User.Info{}, confirmation_status))
 
     if changeset.valid? do
       hashed = Pbkdf2.hashpwsalt(changeset.changes[:password])
index 2800e9cff617adcd9b46bfca40d4f847d8b4dde5..ad9fe1bbeb12c92662350040abc272a60e31dfe8 100644 (file)
@@ -143,21 +143,21 @@ defmodule Pleroma.User.Info do
     ])
   end
 
-  def confirmation_change(info, :confirmed) do
-    confirmation_change(info, %{
+  def confirmation_changeset(info, :confirmed) do
+    confirmation_changeset(info, %{
       confirmation_pending: false,
       confirmation_token: nil
     })
   end
 
-  def confirmation_change(info, :unconfirmed) do
-    confirmation_change(info, %{
+  def confirmation_changeset(info, :unconfirmed) do
+    confirmation_changeset(info, %{
       confirmation_pending: true,
       confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64()
     })
   end
 
-  def confirmation_change(info, params) do
+  def confirmation_changeset(info, params) do
     cast(info, params, [:confirmation_pending, :confirmation_token])
   end
 
index 4bd729b777afd2f7bb37812243d3fd629ebba506..b362f39466eee843822ffc5fa510d9972e192141 100644 (file)
@@ -376,7 +376,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
   def confirm_email(conn, %{"token" => token}) do
     with %User{} = user <- User.get_by_confirmation_token(token),
          true <- user.local,
-         info_change <- User.Info.confirmation_change(user.info, :confirmed),
+         info_change <- User.Info.confirmation_changeset(user.info, :confirmed),
          changeset <- Changeset.change(user) |> Changeset.put_embed(:info, info_change),
          {:ok, _} <- User.update_and_set_cache(changeset) do
       conn
index 26505bab7035cef3a1fdb1f036862b45d85a92eb..0621a8acca5a131fff7ca0cccbcba52c817f7766 100644 (file)
@@ -116,7 +116,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
   test "rejects token exchange for valid credentials belonging to unconfirmed user" do
     password = "testpassword"
     user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
-    info_change = Pleroma.User.Info.confirmation_change(user.info, :unconfirmed)
+    info_change = Pleroma.User.Info.confirmation_changeset(user.info, :unconfirmed)
 
     {:ok, user} =
       user
index a269c9757bcb66082f92a1cc62ed8dec95a362d5..53b39079308b07402948a5f7edc9be8dd8fecc9d 100644 (file)
@@ -876,7 +876,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
   describe "GET /api/account/confirm_email/:token" do
     setup do
       user = insert(:user)
-      info_change = User.Info.confirmation_change(user.info, :unconfirmed)
+      info_change = User.Info.confirmation_changeset(user.info, :unconfirmed)
 
       {:ok, user} =
         user
@@ -908,7 +908,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
   describe "POST /api/account/resend_confirmation_email" do
     setup do
       user = insert(:user)
-      info_change = User.Info.confirmation_change(user.info, :unconfirmed)
+      info_change = User.Info.confirmation_changeset(user.info, :unconfirmed)
 
       {:ok, user} =
         user