dev_tpm_ui
daiao 5 years ago
parent ad2c5212a3
commit 13cb5f0fe5

@ -100,7 +100,7 @@ class HacksController < ApplicationController
@hack.update_attribute(:status, 1) @hack.update_attribute(:status, 1)
base_attrs = { base_attrs = {
trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id, trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id,
parent_container_type: "HackPublish" parent_container_type: "HackPublish", extra: @hack.identifier
} }
@hack.tidings.create!(base_attrs) @hack.tidings.create!(base_attrs)
render_ok render_ok
@ -111,7 +111,7 @@ class HacksController < ApplicationController
@hack.update_attribute(:status, 0) @hack.update_attribute(:status, 0)
base_attrs = { base_attrs = {
trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id, trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id,
parent_container_type: "HackUnPublish" parent_container_type: "HackUnPublish", extra: @hack.identifier
} }
@hack.tidings.create!(base_attrs) @hack.tidings.create!(base_attrs)
render_ok render_ok

@ -56,14 +56,16 @@ class Discuss < ApplicationRecord
send_user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id send_user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
parent_container_type = 'Challenge' parent_container_type = 'Challenge'
challenge_id = challenge_id challenge_id = challenge_id
extra = ''
elsif dis_type == 'Hack' elsif dis_type == 'Hack'
send_user_id = has_parent? ? parent.user_id : Hack.find(dis_id).user_id send_user_id = has_parent? ? parent.user_id : Hack.find(dis_id).user_id
parent_container_type = 'Hack' parent_container_type = 'Hack'
challenge_id = dis_id challenge_id = dis_id
extra = HackUserLastestCode.where(user_id: user_id, hack_id: dis_id).first&.identifier
end end
base_attrs = { base_attrs = {
trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: parent_container_type, trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: parent_container_type,
belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment' belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment', extra: extra
} }
tidings.create!(base_attrs.merge(user_id: send_user_id)) tidings.create!(base_attrs.merge(user_id: send_user_id))
end end

@ -1,5 +1,5 @@
json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type, json.extract! tiding, :id, :status, :viewed, :user_id, :tiding_type, :container_id, :container_type,
:parent_container_id, :parent_container_type, :belong_container_id, :belong_container_type :parent_container_id, :parent_container_type, :belong_container_id, :belong_container_type, :extra
json.content tiding.content json.content tiding.content
json.identifier tiding.identifier json.identifier tiding.identifier

Loading…
Cancel
Save