Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #186 from shahryarjb/master
Browse files Browse the repository at this point in the history
Re-check subscribe of HTML render (home page, and blogs page), fix action of ACL
  • Loading branch information
shahryarjb authored Apr 4, 2022
2 parents 8508dc7 + dd16a23 commit 98a5013
Show file tree
Hide file tree
Showing 3 changed files with 969 additions and 98 deletions.
19 changes: 19 additions & 0 deletions apps/mishka_html/lib/mishka_html_web/live/home_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ defmodule MishkaHtmlWeb.HomeLive do

@impl true
def mount(_params, session, socket) do
if connected?(socket) do
subscribe()
Post.subscribe()
end
Process.send_after(self(), :menu, 100)
socket =
assign(socket,
Expand All @@ -34,11 +38,26 @@ defmodule MishkaHtmlWeb.HomeLive do
{:noreply, socket}
end

@impl true
def handle_info({:post, :ok, _repo_record}, socket) do
{:noreply, update_post_temporary_assigns(socket, socket.assigns.page, socket.assigns.filters, socket.assigns.user_id)}
end

@impl true
def handle_info(_params, socket) do
{:noreply, socket}
end

defp update_post_temporary_assigns(socket, page, _filters, user_id) do
update(socket, :posts, fn _posts ->
Post.posts(conditions: {page, socket.assigns.page_size}, filters: %{}, user_id: user_id)
end)
end

def subscribe do
Phoenix.PubSub.subscribe(MishkaHtml.PubSub, "client_home")
end

defp seo_tags(socket) do
site_link = MishkaHtmlWeb.Router.Helpers.url(socket)
%{
Expand Down
46 changes: 23 additions & 23 deletions apps/mishka_user/lib/acl/action.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@ defmodule MishkaUser.Acl.Action do
def actions(:api) do
%{

"api/content/v1/editor-posts/" => "blog:edit",
"api/content/v1/editor-post/" => "blog:edit",
"api/content/v1/editor-categories/" => "blog:edit",
"api/content/v1/editor-comment/" => "blog:edit",
"api/content/v1/editor-comments/" => "blog:edit",
"api/content/v1/category/" => "blog:edit",
"api/content/v1/edit-comment/" => "blog:edit",
"api/content/v1/delete-comment/" => "blog:edit",
"api/content/v1/destroy-comment/" => "admin:edit",
"api/content/v1/create-tag/" => "admin:edit",
"api/content/v1/edit-tag/" => "admin:edit",
"api/content/v1/delete-tag/" => "admin:edit",
"api/content/v1/add-tag-to-post/" => "blog:edit",
"api/content/v1/remove-post-tag/" => "blog:edit",
"api/content/v1/editor-tag-posts/" => "blog:edit",
"api/content/v1/create-blog-link/" => "blog:edit",
"api/content/v1/edit-blog-link/" => "blog:edit",
"api/content/v1/delete-blog-link/" => "blog:edit",
"api/content/v1/editor-links/" => "blog:edit",
"api/content/v1/editor-notifs/" => "blog:edit",
"api/content/v1/send-notif/" => "*",
"api/content/v1/create-author/" => "blog:edit",
"api/content/v1/delete-author/" => "blog:edit",
"api/content/v1/editor-posts" => "blog:edit",
"api/content/v1/editor-post" => "blog:edit",
"api/content/v1/editor-categories" => "blog:edit",
"api/content/v1/editor-comment" => "blog:edit",
"api/content/v1/editor-comments" => "blog:edit",
"api/content/v1/category" => "blog:edit",
"api/content/v1/edit-comment" => "blog:edit",
"api/content/v1/delete-comment" => "blog:edit",
"api/content/v1/destroy-comment" => "admin:edit",
"api/content/v1/create-tag" => "admin:edit",
"api/content/v1/edit-tag" => "admin:edit",
"api/content/v1/delete-tag" => "admin:edit",
"api/content/v1/add-tag-to-post" => "blog:edit",
"api/content/v1/remove-post-tag" => "blog:edit",
"api/content/v1/editor-tag-posts" => "blog:edit",
"api/content/v1/create-blog-link" => "blog:edit",
"api/content/v1/edit-blog-link" => "blog:edit",
"api/content/v1/delete-blog-link" => "blog:edit",
"api/content/v1/editor-links" => "blog:edit",
"api/content/v1/editor-notifs" => "blog:edit",
"api/content/v1/send-notif" => "*",
"api/content/v1/create-author" => "blog:edit",
"api/content/v1/delete-author" => "blog:edit",


"api/content/v1/create-category/" => "admin:edit",
Expand Down
Loading

0 comments on commit 98a5013

Please sign in to comment.