Introduce the group activity section
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -115,7 +115,10 @@ defmodule Mobilizon.Resources do
|
||||
Multi.new()
|
||||
|> do_find_parent_path(Map.get(attrs, :parent_id))
|
||||
|> Multi.insert(:insert, fn %{find_parent_path: path} ->
|
||||
Resource.changeset(%Resource{}, Map.put(attrs, :path, "#{path}/#{attrs.title}"))
|
||||
Resource.changeset(
|
||||
%Resource{},
|
||||
Map.put(attrs, :path, "#{path}/#{String.replace(attrs.title, "/", "")}")
|
||||
)
|
||||
end)
|
||||
|> Repo.transaction()
|
||||
|> case do
|
||||
@@ -142,7 +145,11 @@ defmodule Mobilizon.Resources do
|
||||
|> update_children(resource, attrs)
|
||||
|> Multi.update(:update, fn %{find_parent_path: path} ->
|
||||
title = Map.get(attrs, :title, old_title)
|
||||
Resource.changeset(resource, Map.put(attrs, :path, "#{path}/#{title}"))
|
||||
|
||||
Resource.changeset(
|
||||
resource,
|
||||
Map.put(attrs, :path, "#{path}/#{String.replace(title, "/", "")}")
|
||||
)
|
||||
end)
|
||||
|> Repo.transaction()
|
||||
|> case do
|
||||
|
||||
Reference in New Issue
Block a user