mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-07 20:43:36 +01:00
if a question was answered, all occurrences of it in the inbox are now gone
This commit is contained in:
parent
72140be316
commit
aec3e1c800
1 changed files with 2 additions and 0 deletions
|
@ -5,6 +5,8 @@ class Answer < ActiveRecord::Base
|
||||||
has_many :smiles, dependent: :destroy
|
has_many :smiles, dependent: :destroy
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
|
Inbox.where(user: self.user, question: self.question).destroy_all
|
||||||
|
|
||||||
Notification.notify self.question.user, self unless self.question.author_is_anonymous
|
Notification.notify self.question.user, self unless self.question.author_is_anonymous
|
||||||
self.user.increment! :answered_count
|
self.user.increment! :answered_count
|
||||||
self.question.increment! :answer_count
|
self.question.increment! :answer_count
|
||||||
|
|
Loading…
Reference in a new issue