Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#653 | Feedback api can take guest's info
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Mar 22, 2021
1 parent b37ee01 commit 7149aa6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ class FeedbackView(APIView): # pragma: no cover
def post(request):
message = request.data.get('description', '') or ''
url = request.data.get('url', False)
name = request.data.get('name', None)
email = request.data.get('email', None)

if not message and not url:
return Response(status=status.HTTP_400_BAD_REQUEST)
Expand All @@ -590,8 +592,8 @@ def post(request):
username = user.username
email = user.email
else:
username = 'Guest'
email = None
username = name or 'Guest'
email = email or None

message += '\n\n' + 'Reported By: ' + username
subject = "[{env}] [FEEDBACK] From: {user}".format(env=settings.ENV.upper(), user=username)
Expand Down

0 comments on commit 7149aa6

Please sign in to comment.