项目社区、课程社区点击我的动态错误,新建用户个人主页显示错误

This commit is contained in:
daiao 2016-12-17 17:04:44 +08:00
parent d16e9e4ecd
commit 96e02cd48f
4 changed files with 21 additions and 10 deletions

View File

@ -1825,7 +1825,11 @@ class UsersController < ApplicationController
messages.each do |message_all|
mess = message_all.message
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@message_alls << mess
if (message_all.message_type =="SystemMessage" && !many_days_ago(mess.created_at, 30))
next
else
@message_alls << mess
end
end
end
@message_count = @message_alls.count
@ -2135,6 +2139,9 @@ class UsersController < ApplicationController
when "course_journals"
container_type = 'Course'
act_type = 'JournalsForMessage'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
@ -2143,12 +2150,15 @@ class UsersController < ApplicationController
if container_type != '' && container_type != 'all'
if container_type == 'Course'
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" +
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) "
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end
@ -2181,6 +2191,9 @@ class UsersController < ApplicationController
when "project_message"
container_type = 'Project'
act_type = 'Message'
when "current_user"
container_type = 'Principal'
act_type = 'Principal'
when "all"
container_type = 'all'
act_type = 'all'
@ -2189,12 +2202,15 @@ class UsersController < ApplicationController
if container_type != '' && container_type != 'all'
if container_type == 'Project'
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end
else
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})"
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) "
if container_type != 'all' && User.current != @user
sql = "user_id = #{@user.id} and(" + sql + ")"
end

View File

@ -66,11 +66,6 @@
</li>
<% end %>
</ul>
<ul class="users_accordion mb10">
<li id="user_10" class="user_icons_mes">
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
</li>
</ul>
</div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>

View File

@ -15,7 +15,7 @@
<li><%= link_to "论坛动态", {:controller => "users", :action => "course_community", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
<li><%= link_to "问卷动态", {:controller => "users", :action => "course_community", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %></li>
<li><%= link_to "班级留言", {:controller => "users", :action => "course_community", :type => "course_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>
<li><%= link_to "个人留言", {:controller => "users", :action => "course_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>
<!-- <li><%#= link_to "个人留言", {:controller => "users", :action => "course_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>-->
<% end %>
</ul>
</li>

View File

@ -13,7 +13,7 @@
:class => "homepagePostTypeMine postTypeGrey" %></li>
<li><%= link_to "问题动态", {:controller => "users", :action => "project_community", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%></li>
<li><%= link_to "论坛动态", {:controller => "users", :action => "project_community", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%></li>
<li><%= link_to "个人留言", {:controller => "users", :action => "project_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>
<!-- <li><%#= link_to "个人留言", {:controller => "users", :action => "project_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>-->
<% end %>
</ul>
</li>