diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1c5435896..4576bb8c8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2109,6 +2109,7 @@ class UsersController < ApplicationController # 课程社区 def course_community + @course_community = "课程" if params[:course_id] != nil join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?", params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false) @@ -2176,6 +2177,7 @@ class UsersController < ApplicationController def project_community # 看别人的主页显示动态 #更新用户申请成为课程老师或教辅消息的状态 + @project_community = "项目" shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aef32f714..8369de39a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1289,7 +1289,13 @@ module ApplicationHelper elsif @organization title << @organization.name elsif @user - title << @user.try(:realname) + if !@project_community.blank? + title << @project_community + elsif !@course_community.blank? + title << @course_community + else + title << @user.try(:realname) + end elsif @syllabus title << @syllabus.title else