diff --git a/src/api/store/campaign.py b/src/api/store/campaign.py index 87769b084..cf78b3440 100644 --- a/src/api/store/campaign.py +++ b/src/api/store/campaign.py @@ -922,6 +922,8 @@ def add_campaign_follower(self, context, args): args["community"] = community follower, _ = CampaignFollow.objects.get_or_create(campaign=campaign, **args) + if not _: + return None, CustomMassenergizeError("Follower already exists!") return follower, None except Exception as e: diff --git a/src/api/tests/integration/test_campaigns.py b/src/api/tests/integration/test_campaigns.py index 8f2078ca1..ed078e60b 100644 --- a/src/api/tests/integration/test_campaigns.py +++ b/src/api/tests/integration/test_campaigns.py @@ -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": "admin@me.com"}) 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": "new.user@gamil.com"}) self.assertEqual(response['success'], True) diff --git a/src/requirements.txt b/src/requirements.txt index b4fdf4f92..71291e271 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -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 \ No newline at end of file +coverage==7.5.0 +python-bidi==0.4.2 \ No newline at end of file