Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit007958d

Browse files
committed
fix(article-editor): update edege case
1 parent82400fe commit007958d

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

‎lib/groupher_server/cms/delegates/article_community.ex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCommunity do
129129

130130
@doc"update isEdited meta label if needed"
131131
# TODO: diff history
132-
defupdate_edit_status(%{meta:%Embeds.ArticleMeta{is_edited:false}=meta}=content)do
132+
defupdate_edit_status(%{meta:%Embeds.ArticleMeta{is_edited:_}=meta}=content)do
133133
meta=meta|>strip_struct|>Map.merge(%{is_edited:true})
134134
ORM.update_meta(content,meta)
135135
end

‎lib/groupher_server/cms/delegates/article_curd.ex‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
278278
end
279279
end)
280280
|>Multi.run(:update_edit_status,fn_,%{update_article:update_article}->
281-
ArticleCommunity.update_edit_status(update_article)
281+
IO.inspect(update_article,label:"## -3")
282+
ArticleCommunity.update_edit_status(update_article)|>IO.inspect(label:"## 2")
282283
end)
283284
|>Multi.run(:after_hooks,fn_,%{update_article:update_article}->
284285
Later.run({Hooks.Cite,:handle,[update_article]})

‎lib/groupher_server_web/schema/cms/cms_types.ex‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ defmodule GroupherServerWeb.Schema.CMS.Types do
6060
general_article_fields()
6161
comments_fields()
6262

63+
field(:is_question,:boolean)
64+
6365
timestamp_fields(:article)
6466
end
6567

‎lib/groupher_server_web/schema/cms/mutations/post.ex‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Post do
1616
arg(:community_id,non_null(:id))
1717
arg(:thread,:thread,default_value::post)
1818
arg(:article_tags,list_of(:id))
19+
arg(:is_question,:boolean)
1920

2021
middleware(M.Authorize,:login)
2122
# middleware(M.PublishThrottle)

‎test/groupher_server_web/mutation/cms/articles/post_test.exs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
2727
$body: String!
2828
$communityId: ID!
2929
$articleTags: [Id]
30+
$linkAddr: String
3031
) {
3132
createPost(
3233
title: $title
3334
body: $body
3435
communityId: $communityId
3536
articleTags: $articleTags
37+
linkAddr: $linkAddr
3638
) {
3739
id
3840
title
41+
linkAddr
3942
document {
4043
bodyHtml
4144
}
@@ -45,19 +48,21 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
4548
}
4649
}
4750
"""
51+
@tag:wip
4852
test"create post with valid attrs and make sure author exsit"do
4953
{:ok,user}=db_insert(:user)
5054
user_conn=simu_conn(:user,user)
5155

5256
{:ok,community}=db_insert(:community)
53-
post_attr=mock_attrs(:post)
57+
post_attr=mock_attrs(:post)|>Map.merge(%{linkAddr:"https://helloworld"})
5458

5559
variables=post_attr|>Map.merge(%{communityId:community.id})
5660
created=user_conn|>mutation_result(@create_post_query,variables,"createPost")
5761
{:ok,post}=ORM.find(Post,created["id"])
5862

5963
assertcreated["id"]==to_string(post.id)
6064
assertcreated["originalCommunity"]["id"]==to_string(community.id)
65+
assertcreated["linkAddr"]=="https://helloworld"
6166

6267
assert{:ok,_}=ORM.find_by(Author,user_id:user.id)
6368
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp