Drop the Notifications and Artifact catalog sidebar rows

b1210d35ed50 · AtlantisPleb · · parent 85a4c56d87eb

Drop the Notifications and Artifact catalog sidebar rows

Both pages keep their routes; the rows and the unread badge leave the
global navigation, and the badge's helper and tests go with them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RfZq5s3rc6zpnBR75pTQaU
Co-Authored-By
Claude Fable 5 <noreply@anthropic.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/live/notifications_live_test.exs

Diff

2 files changed, +0 -86

lib/openagents_web/components/layouts.ex modified -24

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

797 797
        repository's own tabs, which is where a repository-scoped nav
798 798
        belongs. --%>
799 799
        <Layouts.sidebar_link path={~p"/issues"} label="Issues" icon="bug" patchable={false} />
800
        <%!-- The count comes off the scope, which `UserAuth.on_mount/4`
801
        resolves once at mount and refreshes over the account's own topic when
802
        something lands or is marked read. This runs on every render of every
803
        page, so it must stay a field read and never become a query. --%>
804
        <Layouts.sidebar_link
805
          path={~p"/notifications"}
806
          label="Notifications"
807
          icon="notification-bell"
808
          patchable={false}
809
          badge={unread_notifications(@current_scope)}
810
        />
811 800
        <Layouts.sidebar_link
812 801
          path={~p"/projects"}
813 802
          label="Projects"

@@ -825,12 +814,6 @@ defmodule OpenAgentsWeb.Layouts do

825 814
          icon="dumbbell"
826 815
          patchable={false}
827 816
        />
828
        <Layouts.sidebar_link
829
          path={~p"/artifact-catalog"}
830
          label="Artifact catalog"
831
          icon="archive"
832
          patchable={false}
833
        />
834 817
      </nav>
835 818
836 819
      <%!-- The agent's own surfaces, grouped under her name. Chat, computers

@@ -876,13 +859,6 @@ defmodule OpenAgentsWeb.Layouts do

876 859
  defp agent_surfaces?(nil), do: false
877 860
  defp agent_surfaces?(user), do: user.agent_surfaces? or admin?(user)
878 861
879
  # Same rule as `agent_surfaces?`: a field read, never a query. A scope built
880
  # by some other path carries the schema default of zero, so an unresolved
881
  # count shows no badge rather than a wrong one.
882
  defp unread_notifications(nil), do: nil
883
  defp unread_notifications(%{unread_notifications: count}), do: count
884
  defp unread_notifications(_scope), do: nil
885
886 862
  # A nil scope is not an operator. The footer renders on public pages too.
887 863
  defp admin?(nil), do: false
888 864
  defp admin?(user), do: OpenAgents.Accounts.admin?(user)
test/openagents_web/live/notifications_live_test.exs modified -62

@@ -182,66 +182,4 @@ defmodule OpenAgentsWeb.NotificationsLiveTest do

182 182
      refute has_element?(view, "#issue-subscription-toggle")
183 183
    end
184 184
  end
185
186
  describe "the sidebar unread badge" do
187
    test "counts what is waiting and links to the inbox", %{conn: conn} do
188
      %{conn: conn} = setup_thread(conn, "public")
189
190
      {:ok, view, _html} = live(conn, ~p"/notifications")
191
192
      assert has_element?(view, "#sidebar-badge-notifications", "1")
193
    end
194
195
    test "renders nothing at zero", %{conn: conn} do
196
      conn = log_in_github_user(conn, "quiet-badge-account")
197
198
      {:ok, view, _html} = live(conn, ~p"/notifications")
199
200
      refute has_element?(view, "#sidebar-badge-notifications")
201
    end
202
203
    test "appears on a page that is not the inbox", %{conn: conn} do
204
      %{conn: conn} = setup_thread(conn, "public")
205
206
      {:ok, view, _html} = live(conn, ~p"/issues")
207
208
      assert has_element?(view, "#sidebar-badge-notifications", "1")
209
    end
210
211
    test "counts up when a notification arrives, without a reload", %{conn: conn} do
212
      %{conn: conn, issue: issue, actor: actor} = setup_thread(conn, "public")
213
214
      {:ok, view, _html} = live(conn, ~p"/issues")
215
      assert has_element?(view, "#sidebar-badge-notifications", "1")
216
217
      {:ok, _second} = Issues.create_comment(issue, %{"body" => "and another"}, actor)
218
219
      assert has_element?(view, "#sidebar-badge-notifications", "2")
220
    end
221
222
    test "clears when the inbox is marked read, without a reload", %{conn: conn} do
223
      %{conn: conn, reader: reader} = setup_thread(conn, "public")
224
225
      {:ok, view, _html} = live(conn, ~p"/notifications")
226
      assert has_element?(view, "#sidebar-badge-notifications", "1")
227
228
      [notification] = Notifications.list_notifications(reader)
229
      view |> element("#mark-read-#{notification.id}") |> render_click()
230
231
      refute has_element?(view, "#sidebar-badge-notifications")
232
    end
233
234
    test "one account's badge never counts another account's inbox", %{conn: conn} do
235
      %{issue: issue, actor: actor} = setup_thread(conn, "public")
236
237
      stranger = github_user("badge-stranger", "badge-stranger")
238
      stranger_conn = Plug.Test.init_test_session(build_conn(), %{"user_id" => stranger.id})
239
240
      {:ok, view, _html} = live(stranger_conn, ~p"/issues")
241
242
      {:ok, _second} = Issues.create_comment(issue, %{"body" => "not for you"}, actor)
243
244
      refute has_element?(view, "#sidebar-badge-notifications")
245
    end
246
  end
247 185
end

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