@@ -130,19 +130,19 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
130130 { :ok , community } <- ORM . find ( Community , cid ) do
131131 Multi . new ( )
132132 |> Multi . run ( :create_article , fn _ , _ ->
133- do_create_content ( action . target , attrs , author , community )
133+ do_create_article ( action . target , attrs , author , community )
134134 end )
135- |> Multi . run ( :set_community , fn _ , % { create_article: content } ->
136- ArticleOperation . set_community ( community , thread , content . id )
135+ |> Multi . run ( :set_community , fn _ , % { create_article: article } ->
136+ ArticleOperation . set_community ( thread , article . id , community . id )
137137 end )
138- |> Multi . run ( :set_community_flag , fn _ , % { create_article: content } ->
139- exec_set_community_flag ( community , content , action )
138+ |> Multi . run ( :set_community_flag , fn _ , % { create_article: article } ->
139+ exec_set_community_flag ( community , article , action )
140140 end )
141- |> Multi . run ( :set_tag , fn _ , % { create_article: content } ->
142- exec_set_tag ( thread , content . id , attrs )
141+ |> Multi . run ( :set_tag , fn _ , % { create_article: article } ->
142+ exec_set_tag ( thread , article . id , attrs )
143143 end )
144- |> Multi . run ( :mention_users , fn _ , % { create_article: content } ->
145- Delivery . mention_from_content ( community . raw , thread , content , attrs , % User { id: uid } )
144+ |> Multi . run ( :mention_users , fn _ , % { create_article: article } ->
145+ Delivery . mention_from_content ( community . raw , thread , article , attrs , % User { id: uid } )
146146 { :ok , :pass }
147147 end )
148148 |> Multi . run ( :log_action , fn _ , _ ->
@@ -160,7 +160,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
160160 """
161161 def notify_admin_new_content ( % { id: id } = result ) do
162162 target = result . __struct__
163- preload = [ :origial_community , author: :user ]
163+ preload = [ :original_community , author: :user ]
164164
165165 with { :ok , content } <- ORM . find ( target , id , preload: preload ) do
166166 info = % {
@@ -385,13 +385,13 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
385385 end
386386
387387 # for create content step in Multi.new
388- defp do_create_content ( target , attrs , % Author { id: aid } , % Community { id: cid } ) do
388+ defp do_create_article ( target , attrs , % Author { id: aid } , % Community { id: cid } ) do
389389 target
390390 |> struct ( )
391391 |> target . changeset ( attrs )
392392 |> Ecto.Changeset . put_change ( :emotions , @ default_emotions )
393393 |> Ecto.Changeset . put_change ( :author_id , aid )
394- |> Ecto.Changeset . put_change ( :origial_community_id , integerfy ( cid ) )
394+ |> Ecto.Changeset . put_change ( :original_community_id , integerfy ( cid ) )
395395 |> Ecto.Changeset . put_embed ( :meta , @ default_article_meta )
396396 |> Repo . insert ( )
397397 end
0 commit comments