From 020701bcba397d590d284962f3ce5df3134aaa08 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 9 Mar 2010 22:05:39 -0500 Subject: SE loader seems to work, details are in stackexchange/README --- forum/views/commands.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'forum/views/commands.py') diff --git a/forum/views/commands.py b/forum/views/commands.py index 7640afb7..ca6569e2 100755 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -130,7 +130,13 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c elif not __can_vote(vote_score, request.user): response_data['allowed'] = -2 elif post.votes.filter(user=request.user).count() > 0: + #todo: I think we have a bug here + #we need to instead select vote on that particular post + #not just the latest vote, although it is a good shortcut. + #The problem is that this vote is deleted in one of + #the on...Canceled() functions vote = post.votes.filter(user=request.user)[0] + # get latest vote by the current user # unvote should be less than certain time if (datetime.datetime.now().day - vote.voted_at.day) >= auth.VOTE_RULES['scope_deny_unvote_days']: response_data['status'] = 2 @@ -178,8 +184,6 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c item = FlaggedItem(user=request.user, content_object=post, flagged_at=datetime.datetime.now()) auth.onFlaggedItem(item, post, request.user) response_data['count'] = post.offensive_flag_count - # send signal when question or answer be marked offensive - mark_offensive.send(sender=post.__class__, instance=post, mark_by=request.user) elif vote_type in ['9', '10']: post = question post_id = id @@ -195,7 +199,6 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c response_data['status'] = 1 else: auth.onDeleted(post, request.user) - delete_post_or_answer.send(sender=post.__class__, instance=post, delete_by=request.user) elif vote_type == '11':#subscribe q updates user = request.user if user.is_authenticated(): -- cgit v1.2.3-1-g7c22