Add a Forum row to the sidebar footer under Leaderboard

be3304fda434 · Devin AI · · parent 1245da661734

Add a Forum row to the sidebar footer under Leaderboard

The forum has been reachable only by typing /forum. The application shell now
carries a row for it, directly under Leaderboard and for every signed-in
reader. Visitors do not get the row: /forum is in the authenticated scope, so
for them it would link to a login wall rather than to the forum.

Refs #31

Co-Authored-By: Christopher David <chris@openagents.com>
Co-Authored-By
Christopher David <chris@openagents.com>

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified lib/openagents_web/components/layouts.ex
  • modified test/openagents_web/sidebar_state_test.exs

Diff

2 files changed, +40 -0

lib/openagents_web/components/layouts.ex modified +11

@@ -364,6 +364,17 @@ defmodule OpenAgentsWeb.Layouts do

364 364
      <.link navigate={~p"/leaderboard"} class="sidebar-footer__link">
365 365
        <UI.icon name="trophy-top" /> Leaderboard
366 366
      </.link>
367
      <%!-- Signed in only, and directly under Leaderboard. `/forum` is behind
368
      the authenticated scope, so a row for a visitor would be a link to a
369
      login wall rather than to the forum. --%>
370
      <.link
371
        :if={@current_user}
372
        id="open-forum"
373
        navigate={~p"/forum"}
374
        class="sidebar-footer__link"
375
      >
376
        <UI.icon name="forum" /> Forum
377
      </.link>
367 378
      <.link
368 379
        :if={@admin_link?}
369 380
        id="open-admin"
test/openagents_web/sidebar_state_test.exs modified +29

@@ -58,6 +58,35 @@ defmodule OpenAgentsWeb.SidebarStateTest do

58 58
    end
59 59
  end
60 60
61
  describe "the forum row" do
62
    test "an ordinary account sees it under Leaderboard on the application shell", %{conn: conn} do
63
      conn = log_in_github_user(conn, "forum-row-shell")
64
      {:ok, view, html} = live(conn, ~p"/leaderboard")
65
66
      assert has_element?(view, ~s(#sidebar .sidebar-footer a[href="/forum"]))
67
68
      footer = html |> String.split(~s(class="sidebar-footer")) |> Enum.at(1)
69
      leaderboard = :binary.match(footer, ~s(href="/leaderboard"))
70
      forum = :binary.match(footer, ~s(href="/forum"))
71
72
      assert leaderboard != :nomatch and forum != :nomatch
73
      assert elem(leaderboard, 0) < elem(forum, 0), "Forum must follow Leaderboard"
74
    end
75
76
    test "an operator sees it too, ahead of the admin row", %{conn: conn} do
77
      conn = log_in_admin_user(conn, "forum-row-operator")
78
      {:ok, view, _html} = live(conn, ~p"/leaderboard")
79
80
      assert has_element?(view, ~s(#sidebar .sidebar-footer a[href="/forum"]))
81
    end
82
83
    test "a visitor does not, because the forum needs a session", %{conn: conn} do
84
      {:ok, view, _html} = live(conn, ~p"/leaderboard")
85
86
      refute has_element?(view, ~s(.sidebar-footer a[href="/forum"]))
87
    end
88
  end
89
61 90
  describe "collapsed sections survive the first paint" do
62 91
    test "a collapsed section renders collapsed, not open-then-corrected", %{conn: conn} do
63 92
      conn =

This page updates live while a promote is in flight · changelog