Skip to content

Commit

Permalink
One more redirect from Weekly to News
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodsanto committed Sep 18, 2023
1 parent a0857b0 commit e229bae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 6 additions & 2 deletions lib/changelog_web/controllers/person_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ defmodule ChangelogWeb.PersonController do
|> render(:show)
end

def subscribe(conn = %{method: "GET"}, params = %{"to" => to}) when to in ["weekly", "nightly"] do
newsletter = Newsletters.get_by_slug(to)
def subscribe(conn = %{method: "GET"}, params = %{"to" => "weekly"}) do
redirect(conn, to: ~p"/subscribe/news")
end

def subscribe(conn = %{method: "GET"}, params = %{"to" => "nightly"}) do
newsletter = Newsletters.nightly()

conn
|> assign(:newsletter, newsletter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
</div>
<h1 class="signup-heading">You&rsquo;re subscribing to <%= @newsletter.name %></h1>
<p class="signup-text"><%= @newsletter.description %></p>
<p class="signup-text">
<%= if @newsletter.slug == "weekly" do %>
1 email per week — Delivered on Sundays - <%= link("Archive", to: Routes.page_path(@conn, :weekly_archive)) %>
<% else %>
7 emails per week — Delivered daily at 10pm US Central
<% end %>
</p>
<p class="signup-text">7 emails per week — Delivered daily at 10pm US Central</p>
</div>
</section>

Expand Down

0 comments on commit e229bae

Please sign in to comment.