项目社区、课程社区点击我的动态错误,新建用户个人主页显示错误
This commit is contained in:
parent
d16e9e4ecd
commit
96e02cd48f
|
@ -1825,7 +1825,11 @@ class UsersController < ApplicationController
|
||||||
messages.each do |message_all|
|
messages.each do |message_all|
|
||||||
mess = message_all.message
|
mess = message_all.message
|
||||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
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
|
||||||
end
|
end
|
||||||
@message_count = @message_alls.count
|
@message_count = @message_alls.count
|
||||||
|
@ -2135,6 +2139,9 @@ class UsersController < ApplicationController
|
||||||
when "course_journals"
|
when "course_journals"
|
||||||
container_type = 'Course'
|
container_type = 'Course'
|
||||||
act_type = 'JournalsForMessage'
|
act_type = 'JournalsForMessage'
|
||||||
|
when "current_user"
|
||||||
|
container_type = 'Principal'
|
||||||
|
act_type = 'Principal'
|
||||||
when "all"
|
when "all"
|
||||||
container_type = 'all'
|
container_type = 'all'
|
||||||
act_type = 'all'
|
act_type = 'all'
|
||||||
|
@ -2143,12 +2150,15 @@ class UsersController < ApplicationController
|
||||||
if container_type != '' && container_type != 'all'
|
if container_type != '' && container_type != 'all'
|
||||||
if container_type == 'Course'
|
if container_type == 'Course'
|
||||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
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
|
end
|
||||||
if User.current != @user
|
if User.current != @user
|
||||||
sql += " and user_id = #{@user.id}"
|
sql += " and user_id = #{@user.id}"
|
||||||
end
|
end
|
||||||
else
|
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
|
if container_type != 'all' && User.current != @user
|
||||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||||
end
|
end
|
||||||
|
@ -2181,6 +2191,9 @@ class UsersController < ApplicationController
|
||||||
when "project_message"
|
when "project_message"
|
||||||
container_type = 'Project'
|
container_type = 'Project'
|
||||||
act_type = 'Message'
|
act_type = 'Message'
|
||||||
|
when "current_user"
|
||||||
|
container_type = 'Principal'
|
||||||
|
act_type = 'Principal'
|
||||||
when "all"
|
when "all"
|
||||||
container_type = 'all'
|
container_type = 'all'
|
||||||
act_type = 'all'
|
act_type = 'all'
|
||||||
|
@ -2189,12 +2202,15 @@ class UsersController < ApplicationController
|
||||||
if container_type != '' && container_type != 'all'
|
if container_type != '' && container_type != 'all'
|
||||||
if container_type == 'Project'
|
if container_type == 'Project'
|
||||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
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
|
end
|
||||||
if User.current != @user
|
if User.current != @user
|
||||||
sql += " and user_id = #{@user.id}"
|
sql += " and user_id = #{@user.id}"
|
||||||
end
|
end
|
||||||
else
|
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
|
if container_type != 'all' && User.current != @user
|
||||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,11 +66,6 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</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>
|
</div>
|
||||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||||
<% update_visiti_count @user %>
|
<% update_visiti_count @user %>
|
||||||
|
|
|
@ -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_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_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 => "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 %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:class => "homepagePostTypeMine postTypeGrey" %></li>
|
: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_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 => "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 %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue