Skip to content

Commit

Permalink
Allow URLs in developer replies to ratings (#22749)
Browse files Browse the repository at this point in the history
  • Loading branch information
diox authored and KevinMind committed Oct 17, 2024
1 parent 399cbb3 commit 191d6a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/olympia/ratings/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class RatingSerializerReply(BaseRatingSerializer):
allow_null=False,
required=True,
allow_blank=False,
validators=[NoURLsValidator()],
)

def to_representation(self, obj):
Expand Down
19 changes: 19 additions & 0 deletions src/olympia/ratings/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3034,6 +3034,25 @@ def test_reply(self):

assert len(mail.outbox) == 1

def test_reply_allows_urls(self):
self.addon_author = user_factory()
self.addon.addonuser_set.create(user=self.addon_author)
self.client.login_api(self.addon_author)
response = self.client.post(
self.url,
data={
'body': 'My réply... https://example.com is nice.',
},
)
assert response.status_code == 201
review = Rating.objects.latest('pk')
assert review.pk == response.data['id']
assert (
review.body
== response.data['body']
== 'My réply... https://example.com is nice.'
)

def test_reply_if_a_reply_already_exists_updates_existing(self):
self.addon_author = user_factory()
self.addon.addonuser_set.create(user=self.addon_author)
Expand Down

0 comments on commit 191d6a0

Please sign in to comment.