diff --git a/app/models/message.rb b/app/models/message.rb index 6d108e607..3bb08f481 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -199,8 +199,7 @@ class Message < ActiveRecord::Base def act_as_forge_activity # 如果project为空,那么就是课程相关的消息 if self.board.project_id != -1 && self.parent_id.nil? - self.forge_acts << ForgeActivity.new(:user_id => self.author_id, - :project_id => self.board.project.id) + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id) end end diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 65cfd11f3..9cca5da5c 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -44,7 +44,7 @@ - + diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 8017081c6..5a9f7e398 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -86,9 +86,7 @@
-
回复( - <%=count %> - )
+
回复(<%=count %>)
<%#=format_date(activity.updated_on)%>
<%if count>3 %> diff --git a/db/migrate/20160105073350_drop_message_for_forge_activities.rb b/db/migrate/20160105073350_drop_message_for_forge_activities.rb new file mode 100644 index 000000000..b4fa5e36a --- /dev/null +++ b/db/migrate/20160105073350_drop_message_for_forge_activities.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 3728e8da0..9655824a0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.integer "act_id", :null => false