Skip to content

Commit

Permalink
Slack feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
blopker committed Nov 3, 2023
1 parent 1f13801 commit 3bb3b9a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions totem/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from totem.circles.filters import upcoming_events_user_can_attend
from totem.email import emails
from totem.utils.slack import notify_slack

from . import analytics
from .forms import LoginForm
Expand Down Expand Up @@ -220,9 +221,12 @@ def user_feedback_view(request):
form = FeedbackForm(data)
if form.is_valid():
if request.user.is_authenticated:
name = request.user.name
Feedback.objects.create(**form.cleaned_data, user=request.user)
else:
name = "Anonymous"
Feedback.objects.create(**form.cleaned_data)
messages.success(request, "Feedback successfully submitted. Thank you!")
notify_slack(f"Feedback from {name}! \nMessage: \n{form.cleaned_data['message']}")
form = FeedbackForm()
return render(request, "users/feedback.html", context={"form": form})

0 comments on commit 3bb3b9a

Please sign in to comment.