|
|
|
@ -54,9 +54,14 @@ class Discuss < ApplicationRecord
|
|
|
|
|
def send_tiding
|
|
|
|
|
base_attrs = {
|
|
|
|
|
trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: 'Challenge',
|
|
|
|
|
belong_container_id: dis_id, belong_container_type: 'Shixun', viewed: 0, tiding_type: 'Comment'
|
|
|
|
|
belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment'
|
|
|
|
|
}
|
|
|
|
|
user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
|
|
|
|
|
user_id =
|
|
|
|
|
if dis_type == 'Shixun'
|
|
|
|
|
has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
|
|
|
|
|
elsif dis_type == 'Hack'
|
|
|
|
|
has_parent? ? parent.user_id : Hack.find(dis_id).user_id
|
|
|
|
|
end
|
|
|
|
|
tidings.create!(base_attrs.merge(user_id: user_id))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|