Skip to content

Commit 0af5323

Browse files
committed
adds best_answer_accepted and best_answer_unaccepted signals
1 parent 37ddfbb commit 0af5323

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

askbot/models/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def user_can_anonymize_account(self, user):
531531
# non-admins cannot remove admins or moderators
532532
if not self.is_administrator() and user.is_administrator_or_moderator():
533533
return False
534-
534+
535535
if perm == 'admins':
536536
return self.is_administrator() and self.pk != user.pk
537537
elif self.is_administrator_or_moderator():
@@ -1872,6 +1872,7 @@ def user_accept_best_answer(
18721872
auth.onAnswerAcceptCanceled(accepted_answer, self)
18731873

18741874
auth.onAnswerAccept(answer, self, timestamp=timestamp)
1875+
signals.best_answer_accepted.send(None, answer=answer, user=self, timestamp=timestamp)
18751876
award_badges_signal.send(None,
18761877
event='accept_best_answer',
18771878
actor=self,
@@ -1888,6 +1889,7 @@ def user_unaccept_best_answer(
18881889
self.assert_can_unaccept_best_answer(answer)
18891890
if not answer.endorsed:
18901891
return
1892+
signals.best_answer_unaccepted.send(None, answer=answer, user=self, timestamp=timestamp)
18911893
auth.onAnswerAcceptCanceled(answer, self)
18921894

18931895
@auto_now_timestamp

askbot/signals.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
new_comment_posted = django.dispatch.Signal()
3636
answer_edited = django.dispatch.Signal()
3737
question_visited = django.dispatch.Signal()
38+
best_answer_accepted = django.dispatch.Signal()
39+
best_answer_unaccepted = django.dispatch.Signal()
3840

3941
post_updated = django.dispatch.Signal()
4042

0 commit comments

Comments
 (0)