Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 9a7dcb2

Browse files
committed
fix(conflict): from dev
1 parent e8fe3db commit 9a7dcb2

File tree

8 files changed

+7
-18
lines changed

8 files changed

+7
-18
lines changed

lib/groupher_server_web/middleware/pagesize_proof.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ defmodule GroupherServerWeb.Middleware.PageSizeProof do
2222
_info
2323
)
2424
when not is_nil(customization) do
25-
size = String.to_integer(customization.display_density)
26-
size = if size > @max_page_size, do: @max_page_size, else: size
25+
# NOTE: c11n display_density should also linted by page limit,
26+
# otherwise dataloader will crash for empty extra items
27+
size = customization.display_density |> String.to_integer() |> min(@max_page_size)
2728

2829
case Map.has_key?(arguments, :filter) do
2930
true ->

test/groupher_server/delivery/mention_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ defmodule GroupherServer.Test.Delivery.Mention do
127127

128128
filter = %{page: 1, size: 20, read: true}
129129
{:ok, mentions} = Accounts.fetch_mentions(user, filter)
130-
# IO.inspect mentions, label: "hello mentions"
130+
131131
assert mentions.total_count == 3
132132
end
133133
end

test/groupher_server/seeds/communities_test.exs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ defmodule GroupherServer.Test.Seeds.Communities do
2626

2727
{:ok, found} = ORM.find(CMS.Community, radom_community.id, preload: :categories)
2828
assert length(found.categories) !== 0
29-
30-
# {:ok, tags} = ORM.find_all(CMS.Tag, %{page: 1, size: 20})
31-
# IO.inspect tags, label: "hello tags"
3229
end
3330

3431
test "city communities seeds works" do
@@ -43,9 +40,6 @@ defmodule GroupherServer.Test.Seeds.Communities do
4340

4441
{:ok, found} = ORM.find(CMS.Community, radom_community.id, preload: :categories)
4542
assert length(found.categories) !== 0
46-
47-
# {:ok, tags} = ORM.find_all(CMS.Tag, %{page: 1, size: 20})
48-
# IO.inspect tags, label: "hello tags"
4943
end
5044

5145
test "home community seeds works" do

test/groupher_server/statistics/statistics_test.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ defmodule GroupherServer.Test.Statistics do
5858

5959
{:ok, contributes} = Statistics.list_contributes(%User{id: user.id})
6060
assert length(contributes.records) == 1
61-
62-
# hello = Statistics.list_contributes(%User{id: user.id})
63-
# IO.inspect hello, label: "hello"
6461
end
6562

6663
test "should inserted a contribute when the user not contribute before", ~m(user)a do

test/groupher_server_web/mutation/cms/post_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ defmodule GroupherServer.Test.Mutation.Post do
6363
assert {:ok, _} = ORM.find_by(CMS.Author, user_id: user.id)
6464
end
6565

66+
@tag :wip
6667
test "create post should excape xss attracts" do
6768
{:ok, user} = db_insert(:user)
6869
user_conn = simu_conn(:user, user)
6970

7071
{:ok, community} = db_insert(:community)
71-
post_attr = mock_attrs(:post, %{body: assert_v(:xss_string)})
72+
post_attr = mock_attrs(:post, %{body: "<script>alert(\"hello,world\")</script>"})
7273

7374
variables = post_attr |> Map.merge(%{communityId: community.id})
7475
created = user_conn |> mutation_result(@create_post_query, variables, "createPost")
7576
{:ok, post} = ORM.find(CMS.Post, created["id"])
7677

77-
assert post.body == assert_v(:xss_safe_string)
78+
assert post.body == "&lt;script&gt;alert(&quot;hello,world&quot;)&lt;/script&gt;"
7879
end
7980

8081
# NOTE: this test is IMPORTANT, cause json_codec: Jason in router will cause

test/groupher_server_web/mutation/cms/repo_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ defmodule GroupherServer.Test.Mutation.Repo do
149149
"updateRepo"
150150
)
151151

152-
# IO.inspect(updated, label: "hello")
153152
assert updated["title"] == "new title"
154153
assert updated["readme"] == "new readme"
155154
end

test/groupher_server_web/mutation/cms/wiki_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ defmodule GroupherServer.Test.Mutation.CMS.Wiki do
2929
{:ok, user} = db_insert(:user)
3030
user_conn = simu_conn(:user, user)
3131

32-
# IO.inspect(mock_attrs(:wiki) |> camelize_map_key, label: "hello ...")
3332
wiki_attrs = mock_attrs(:wiki) |> camelize_map_key
3433

3534
variables = wiki_attrs |> Map.merge(%{communityId: community.id})

test/groupher_server_web/query/accounts/account_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ defmodule GroupherServer.Test.Query.Account.Basic do
196196
results = guest_conn |> query_result(@query, variables, "user")
197197
subscribed_communities = results["subscribedCommunities"]["entries"]
198198

199-
# IO.inspect subscribed_communities, label: "hello subed"
200-
201199
subscribed_communities_count = results["subscribedCommunitiesCount"]
202200
[community_1, community_2, community_3, community_x] = communities |> firstn_and_last(3)
203201

0 commit comments

Comments
 (0)