From 7dcdaa516bb9253b25e058b650fd56075631c83f Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 23 Feb 2017 18:14:43 +0100 Subject: [PATCH] a few fixes on comments --- rowers/models.py | 2 +- rowers/tasks.py | 2 +- rowers/views.py | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index e9dc8228..c52c34ed 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -891,7 +891,7 @@ class WorkoutComment(models.Model): comment = models.TextField(max_length=300) created = models.DateTimeField(default=timezone.now) read = models.BooleanField(default=False) - notification = models.BooleanField(default=False,verbose_name="Send me notifications") + notification = models.BooleanField(default=True,verbose_name="Subscribe to new comment notifications") user = models.ForeignKey(User) workout = models.ForeignKey(Workout) diff --git a/rowers/tasks.py b/rowers/tasks.py index 40d8747b..afa33a11 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -293,7 +293,7 @@ def handle_sendemailnewresponse(first_name,last_name, message += '\n\n' message += 'You are receiving this email because you are subscribed ' message += 'to comments on this workout. To unsubscribe, follow this link:\n' - message += 'https://rowsandall.com/rowers/workout/unsubscribe/'+str(workoutid)+'/' + message += 'https://rowsandall.com/rowers/workout/'+str(workoutid)+'/unsubscribe' email = EmailMessage(subject, message, 'Rowsandall ', diff --git a/rowers/views.py b/rowers/views.py index fc23bcf0..26ad82c9 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -3641,7 +3641,7 @@ def workout_comment_view(request,id=0): c = WorkoutComment(workout=w,user=request.user,comment=comment, notification=notification) c.save() - if settings.DEBUG: + if settings.DEBUG and request.user != r.user: res = handle_sendemailnewcomment.delay(r.user.first_name, r.user.last_name, r.user.email, @@ -3661,7 +3661,7 @@ def workout_comment_view(request,id=0): commenters = {oc.user for oc in comments if oc.notification} for u in commenters: - if settings.DEBUG: + if settings.DEBUG and u != request.user and u != r.user: res = handle_sendemailnewresponse.delay(u.first_name, u.last_name, u.email, @@ -3671,7 +3671,7 @@ def workout_comment_view(request,id=0): w.name, w.id, c.id) - else: + elif u != request.user and u != r.user: res = queuelow.enqueue(handle_sendemailnewresponse, u.first_name, u.last_name, @@ -3683,6 +3683,10 @@ def workout_comment_view(request,id=0): w.id, c.id) + url = reverse(workout_comment_view,kwargs = { + 'id':id}) + return HttpResponseRedirect(url) + form = WorkoutCommentForm() return render(request,