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.

Commite56b586

Browse files
committed
fix(community): error test
1 parente78a315 commite56b586

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ defmodule GroupherServer.CMS.Delegate.CommunityOperation do
145145
with{:ok,community}<-ORM.find(Community,community_id),
146146
true<-community.raw!=="home"do
147147
Multi.new()
148-
|>Multi.run(:update_community_count,fn_,_->
149-
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
150-
end)
151148
|>Multi.run(:unsubscribed_community,fn_,_->
152149
ORM.findby_delete!(CommunitySubscriber,%{community_id:community.id,user_id:user_id})
153150
end)
151+
|>Multi.run(:update_community_count,fn_,_->
152+
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
153+
end)
154154
|>Repo.transaction()
155155
|>result()
156156
else
@@ -170,12 +170,12 @@ defmodule GroupherServer.CMS.Delegate.CommunityOperation do
170170
with{:ok,community}<-ORM.find(Community,community_id),
171171
true<-community.raw!=="home"do
172172
Multi.new()
173-
|>Multi.run(:update_community_count,fn_,_->
174-
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
175-
end)
176173
|>Multi.run(:unsubscribed_community,fn_,_->
177174
ORM.findby_delete!(CommunitySubscriber,%{community_id:community.id,user_id:user_id})
178175
end)
176+
|>Multi.run(:update_community_count,fn_,_->
177+
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
178+
end)
179179
|>Multi.run(:update_community_geo,fn_,_->
180180
update_community_geo(community_id,user_id,remote_ip,:dec)
181181
end)
@@ -198,12 +198,12 @@ defmodule GroupherServer.CMS.Delegate.CommunityOperation do
198198
with{:ok,community}<-ORM.find(Community,community_id),
199199
true<-community.raw!=="home"do
200200
Multi.new()
201-
|>Multi.run(:update_community_count,fn_,_->
202-
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
203-
end)
204201
|>Multi.run(:unsubscribed_community,fn_,_->
205202
ORM.findby_delete!(CommunitySubscriber,%{community_id:community.id,user_id:user_id})
206203
end)
204+
|>Multi.run(:update_community_count,fn_,_->
205+
CommunityCURD.update_community_count_field(community,user_id,:subscribers_count,:dec)
206+
end)
207207
|>Multi.run(:update_community_geo_city,fn_,_->
208208
update_community_geo_map(community.id,city,:dec)
209209
end)

‎test/groupher_server/cms/community/community_test.exs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ defmodule GroupherServer.Test.CMS.Community do
9393
assertuser.idincommunity.meta.subscribed_user_ids
9494
end
9595

96+
@tag:wip2
9697
test"user unsubscribe a community will update the community's subscribted info",
9798
~m(user community)ado
9899
{:ok,_}=CMS.subscribe_community(community,user)

‎test/groupher_server_web/mutation/cms/cms_test.exs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Basic do
401401

402402
result=rule_conn|>mutation_result(@set_editor_query,variables,"setEditor")
403403

404-
assertresult["id"]==to_string(user.id)
404+
assertresult["id"]==to_string(community.id)
405405
end
406406

407407
@unset_editor_query"""
@@ -508,7 +508,6 @@ defmodule GroupherServer.Test.Mutation.CMS.Basic do
508508
assertguest_conn|>mutation_get_error?(@subscribe_query,variables,ecode(:account_login))
509509
end
510510

511-
@tag:wip2
512511
test"subscribed community should inc it's own geo info",~m(user community)ado
513512
login_conn=simu_conn(:user,user)
514513

@@ -529,7 +528,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Basic do
529528
}
530529
}
531530
"""
532-
@tag:wip2
531+
533532
test"login user can unsubscribe community",~m(user community)ado
534533
{:ok,cur_subscribers}=
535534
CMS.community_members(:subscribers,%Community{id:community.id},%{page:1,size:10})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp