Skip to content

Commit

Permalink
Make if condition on boolean more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
kracekumar committed Jun 11, 2017
1 parent 4b70b2d commit 38ec445
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions junction/proposals/comments_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def create_proposal_comment(request, conference_slug, proposal_slug):
Proposal, slug=proposal_slug, conference=conference)
form = ProposalCommentForm(request.POST)

if request.user.is_active == False:
if request.user.is_active is False:
raise PermissionDenied()

if form.is_valid():
Expand Down Expand Up @@ -69,7 +69,7 @@ def create_proposal_comment(request, conference_slug, proposal_slug):
@login_required
@require_http_methods(['POST'])
def mark_comment_as_spam(request, conference_slug, proposal_slug, proposal_comment_id):
if not request.is_ajax() or request.user.is_active == False:
if not request.is_ajax() or request.user.is_active is False:
return HttpResponseForbidden()

conference = get_object_or_404(Conference, slug=conference_slug)
Expand All @@ -94,7 +94,7 @@ def mark_comment_as_spam(request, conference_slug, proposal_slug, proposal_comme
@login_required
@require_http_methods(['POST'])
def unmark_comment_as_spam(request, conference_slug, proposal_slug, proposal_comment_id):
if not request.is_ajax() or request.user.is_active == False:
if not request.is_ajax() or request.user.is_active is False:
return HttpResponseForbidden()

conference = get_object_or_404(Conference, slug=conference_slug)
Expand Down
6 changes: 3 additions & 3 deletions junction/proposals/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ def send_mail_for_proposal_content(conference_id, proposal_id, host):


def user_action_for_spam(user, threshold):
"""When a comment is mark as spam, make appropriate status update to user model
"""When a comment is marked as spam, make appropriate status update to user model
"""
total_spam = ProposalComment.objects.filter(commenter=user, is_spam=True).count()
if total_spam >= threshold:
if user.is_active != False:
if user.is_active is True:
user.is_active = False
user.save()
else:
if user.is_active != True:
if user.is_active is False:
user.is_active = True
user.save()

0 comments on commit 38ec445

Please sign in to comment.