Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Handling Existing Campaign Followers #1045

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/store/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@
args["community"] = community

follower, _ = CampaignFollow.objects.get_or_create(campaign=campaign, **args)
if not _:
return None, CustomMassenergizeError("Follower already exists!")

Check warning on line 926 in src/api/store/campaign.py

View check run for this annotation

Codecov / codecov/patch

src/api/store/campaign.py#L926

Added line #L926 was not covered by tests

return follower, None
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions src/api/tests/integration/test_campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,13 @@ def test_add_campaign_follower(self):

Console.header("Testing the campaigns.follow endpoint as a community admin.")
signinAs(self.client, self.CADMIN)
response = self.make_request("campaigns.follow", payload)
response = self.make_request("campaigns.follow", {**payload, "email": "[email protected]"})
self.assertEqual(response['success'], True)


Console.header("Testing the campaigns.follow endpoint as a user.")
signinAs(self.client, self.USER)
response = self.make_request("campaigns.follow", payload)
response = self.make_request("campaigns.follow", {**payload, "email": "[email protected]"})
self.assertEqual(response['success'], True)


Expand Down
3 changes: 2 additions & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ python-slugify==8.0.1
better-profanity==0.7.0
django-cid==2.3
watchtower==3.1.0
coverage==7.5.0
coverage==7.5.0
python-bidi==0.4.2
Loading