添加迁移:项目讨论区数据重复问题
This commit is contained in:
parent
428eb018a3
commit
be218baa52
|
@ -199,8 +199,7 @@ class Message < ActiveRecord::Base
|
||||||
def act_as_forge_activity
|
def act_as_forge_activity
|
||||||
# 如果project为空,那么就是课程相关的消息
|
# 如果project为空,那么就是课程相关的消息
|
||||||
if self.board.project_id != -1 && self.parent_id.nil?
|
if self.board.project_id != -1 && self.parent_id.nil?
|
||||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id)
|
||||||
:project_id => self.board.project.id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,7 @@
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||||
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
|
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%=count %>)</div>
|
||||||
<%=count %>
|
|
||||||
)</div>
|
|
||||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||||
<%if count>3 %>
|
<%if count>3 %>
|
||||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class DropMessageForForgeActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
forge_activities = ForgeActivity.where("forge_act_type =?", "Message")
|
||||||
|
forge_activities.each do |fa|
|
||||||
|
# 删除项目动态中,讨论区也会多一条记录问题
|
||||||
|
if fa.forge_act && !fa.forge_act.parent_id.nil?
|
||||||
|
fa.delete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20151231023610) do
|
ActiveRecord::Schema.define(:version => 20160105073350) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue