diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-03-09 22:05:39 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-03-09 22:05:39 -0500 |
commit | 020701bcba397d590d284962f3ce5df3134aaa08 (patch) | |
tree | d152d879fe3396c6d8591762c8c5284e9dcca56a /forum/views/commands.py | |
parent | c813ea591905e90512f2f04c68d251da3eb77eaa (diff) | |
download | askbot-020701bcba397d590d284962f3ce5df3134aaa08.tar.gz askbot-020701bcba397d590d284962f3ce5df3134aaa08.tar.bz2 askbot-020701bcba397d590d284962f3ce5df3134aaa08.zip |
SE loader seems to work, details are in stackexchange/README
Diffstat (limited to 'forum/views/commands.py')
-rwxr-xr-x | forum/views/commands.py | 9 |
1 files changed, 6 insertions, 3 deletions
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(): |