~sbaildon/courtesy

7684e2f39d8c396f15b155e01df47f6cd392eb38 — Sean Baildon 7 months ago c84bbb9
account slug everywhere
M lib/client/controllers/settings_controller.ex => lib/client/controllers/settings_controller.ex +6 -4
@@ 3,10 3,12 @@ defmodule Client.SettingsController do

  alias Courtesy.Accounts

  def opt_in(conn, %{"account_id" => account_id, "token" => token}) do
    with {:ok, user} <- Yemma.confirm_user(token, account_id),
         {:ok, _membership} <- Accounts.maybe_assign_member(account_id, user.id, "patron") do
      redirect(conn, to: ~p"/#{account_id}")
  def opt_in(conn, %{"account_slug" => account_slug, "token" => token}) do
    with {:ok, account} <- Accounts.get_by_slug(account_slug),
         {:ok, user} <- Yemma.confirm_user(token, account.id),
         {:ok, _membership} <- Accounts.maybe_assign_member(account.id, user.id, "patron") do
      Process.put(:courtesy_app, :client)
      redirect(conn, to: ~p"/#{account}")
    end
  end
end

M lib/client/routes.ex => lib/client/routes.ex +3 -2
@@ 2,7 2,8 @@ defmodule Client.Routes do
  @moduledoc false
  use Client, :verified_routes

  def opt_in(account_id, token) do
    url(~p"/#{account_id}/settings/notifications/opt_in?#{[token: token]}")
  def opt_in(account, token) do
    Process.put(:courtesy_app, :client)
    url(~p"/#{account}/settings/notifications/opt_in?#{[token: token]}")
  end
end

M lib/concierge/notifiers/registration_notifier.ex => lib/concierge/notifiers/registration_notifier.ex +1 -1
@@ 34,7 34,7 @@ defmodule Courtesy.RegistrationNotifier do
  end

  defp make_email(account, user, token) do
    link = Client.Routes.opt_in(account.id, token)
    link = Client.Routes.opt_in(account, token)
    sender = sender(account)
    {:ok, Mail.opt_in(account, user, sender, link)}
  end