Introduce the group activity section

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-02-24 19:06:48 +01:00
parent d0567f783d
commit 3fe64a4389
70 changed files with 3224 additions and 70 deletions

View File

@@ -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