more fixes
This commit is contained in:
parent
bde8b64977
commit
c846b963a4
|
@ -3,7 +3,7 @@ class QuestionWorker
|
||||||
|
|
||||||
sidekiq_options queue: :question, retry: false
|
sidekiq_options queue: :question, retry: false
|
||||||
|
|
||||||
# @param rcpt [Integer] string recipient
|
# @param rcpt [String] recipient
|
||||||
# @param user_id [Integer] user id passed from Devise
|
# @param user_id [Integer] user id passed from Devise
|
||||||
# @param question_id [Integer] newly created question id
|
# @param question_id [Integer] newly created question id
|
||||||
def perform(rcpt, user_id, question_id)
|
def perform(rcpt, user_id, question_id)
|
||||||
|
@ -11,12 +11,14 @@ class QuestionWorker
|
||||||
user = User.find(user_id)
|
user = User.find(user_id)
|
||||||
if rcpt == 'followers'
|
if rcpt == 'followers'
|
||||||
user.followers.each do |f|
|
user.followers.each do |f|
|
||||||
Inbox.create(user_id: fid, question_id: question_id, new: true)
|
Inbox.create!(user_id: f.id, question_id: question_id, new: true)
|
||||||
end
|
end
|
||||||
elsif rcpt.start_with? 'grp:'
|
elsif rcpt.start_with? 'grp:'
|
||||||
current_user.groups.find_by_name!(rcpt.sub 'grp:', '').members.each do |m|
|
user.groups.find_by_name!(rcpt.sub 'grp:', '').members.each do |m|
|
||||||
Inbox.create(user_id: m.user.id, question_id: question.id, new: true)
|
Inbox.create!(user_id: m.user.id, question_id: question_id, new: true)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
logger.info "unknown rcpt #{rcpt}"
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
logger.info "failed to ask question: #{e.message}"
|
logger.info "failed to ask question: #{e.message}"
|
||||||
|
|
Loading…
Reference in New Issue