首页不显示项目的创建动态

This commit is contained in:
cxt 2016-05-19 15:26:23 +08:00
parent 05a475e47e
commit 6517f23f03
12 changed files with 24 additions and 15 deletions

View File

@ -36,7 +36,7 @@ module Mobile
user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
project_types = "('Message','Issue','ProjectCreateInfo')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(','))
user_ids = "(" + user.id.to_s + watched_user_ids + ")"

View File

@ -14,7 +14,7 @@ module Mobile
else
case f
when :user_act
if ac.act_type == "ProjectCreateInfo"
if ac.act_type == "Project"
ac unless ac.nil?
else
ac.act unless ac.nil? || ac.act.nil?
@ -87,7 +87,7 @@ module Mobile
"项目缺陷"
when "Message"
"项目讨论区"
when "ProjectCreateInfo"
when "Project"
"项目"
end
end
@ -101,7 +101,7 @@ module Mobile
expose :container_type #课程/项目/博客/个人
expose :author, using: Mobile::Entities::User do |a, opt| #用户信息
if a.is_a? ::UserActivity
if a.act_type == "ProjectCreateInfo"
if a.act_type == "Project"
get_user(get_project(a.act_id).user_id)
elsif !a.act.nil?
if a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment'

View File

@ -127,7 +127,7 @@ class OrganizationsController < ApplicationController
case params[:type]
when nil
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
"or (container_type ='Project' and org_act_type in ('Issue','Message','Project') and container_id in (#{project_ids.join(',')})) "+
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
when 'project_issue'

View File

@ -1373,7 +1373,7 @@ class UsersController < ApplicationController
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
project_types = "('Message','Issue','ProjectCreateInfo')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
if params[:type].present?
case params[:type]

View File

@ -211,7 +211,7 @@ class WechatsController < ActionController::Base
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
project_types = "('Message','Issue','ProjectCreateInfo')"
project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage"
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"

View File

@ -5,8 +5,7 @@ class CourseActivity < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
after_save :add_user_activity, :add_org_activity
after_create :add_course_lead
after_create :add_course_lead,:add_user_activity, :add_org_activity
before_destroy :destroy_user_activity, :destroy_org_activity
#在个人动态里面增加当前动态

View File

@ -20,7 +20,7 @@ class ForgeActivity < ActiveRecord::Base
validates :forge_act_id,presence: true
validates :forge_act_type, presence: true
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
after_save :add_user_activity, :add_org_activity
after_create :add_user_activity, :add_org_activity
before_destroy :destroy_user_activity, :destroy_org_activity
#在个人动态里面增加当前动态

View File

@ -56,7 +56,7 @@
<%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %>
<% when 'Message' %>
<%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
<% when 'ProjectCreateInfo'%>
<% when 'Project'%>
<%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
<% end %>
<% end %>

View File

@ -6,7 +6,7 @@
<%= render :partial => 'organizations/org_project_issue', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
<% when 'Message' %>
<%= render :partial => 'organizations/project_message', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
<% when 'ProjectCreateInfo'%>
<% when 'Project'%>
<%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
<% end %>
<% end %>

View File

@ -54,7 +54,7 @@
sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>");
});
</script>
<% if user_activity.act_type == "ProjectCreateInfo" %>
<% if user_activity.act_type == "Project" %>
<%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %>
<% else %>
<% act= user_activity.act %>
@ -94,7 +94,7 @@
<%# end %>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'ProjectCreateInfo'%>
<% when 'Project'%>
<%# cache (act) do %>
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>

View File

@ -0,0 +1,9 @@
class ChangeUserActivitiesData < ActiveRecord::Migration
def up
execute("update user_activities set act_type = 'Project' where act_type = 'ProjectCreateInfo'")
execute("update org_activities set org_act_type = 'Project' where org_act_type = 'ProjectCreateInfo'")
end
def down
end
end

View File

@ -11,7 +11,8 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160511055221) do
ActiveRecord::Schema.define(:version => 20160519070718) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
t.string "act_type", :null => false