Skip to content

Commit

Permalink
fix: masters could not edit a post
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoCoelho2003 committed Feb 3, 2025
1 parent df47eb3 commit 15bd5da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/atomic_web/live/announcement_live/edit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ defmodule AtomicWeb.AnnouncementLive.Edit do
end

@impl true
def handle_params(%{"organization_id" => _organization_id, "id" => id}, _, socket) do
def handle_params(%{"organization_id" => organization_id, "id" => id}, _, socket) do
announcement = Organizations.get_announcement!(id)
organization = Organizations.get_organization!(organization_id)

{:noreply,
socket
|> assign(:current_page, :activities)
|> assign(:page_title, gettext("Edit Announcements"))
|> assign(:announcement, announcement)}
|> assign(:announcement, announcement)
|> assign(:current_organization, organization)}
end
end
2 changes: 1 addition & 1 deletion lib/atomic_web/live/home_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<.activity activity={post.activity} />
</.link>
<% else %>
<.link navigate={~p"/announcements/#{post.announcement}"}>
<.link navigate={~p"/organizations/#{post.announcement.organization.id}/announcements/#{post.announcement}"}>
<.announcement announcement={post.announcement} />
</.link>
<% end %>
Expand Down

0 comments on commit 15bd5da

Please sign in to comment.