更新用户申请加入项目以及反馈的消息的状态
This commit is contained in:
parent
586cde6f87
commit
d509ef01e8
|
@ -381,6 +381,11 @@ class ApplicationController < ActionController::Base
|
|||
if allowed
|
||||
true
|
||||
else
|
||||
if params[:action] == 'show'
|
||||
#更新申请结果反馈消息的状态
|
||||
messages = CourseMessage.where("course_message_type =? and course_id =? and user_id =? and viewed =?", 'CourseRequestDealResult', @course.id, User.current.id, false)
|
||||
messages.update_all(:viewed => true)
|
||||
end
|
||||
if @course && @course.archived?
|
||||
render_403 :message => :notice_not_authorized_archived_project
|
||||
else
|
||||
|
|
|
@ -617,6 +617,10 @@ class CoursesController < ApplicationController
|
|||
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
|
||||
create_course_messages.update_all(:viewed => true)
|
||||
|
||||
#更新申请结果反馈消息的状态
|
||||
course_request_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @course.id, 'CourseRequestDealResult', false)
|
||||
course_request_messages.update_all(:viewed => true)
|
||||
|
||||
course_activities = @course.course_activities
|
||||
@canShowRealName = User.current.member_of_course? @course
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
|
|
|
@ -919,7 +919,8 @@ class UsersController < ApplicationController
|
|||
|
||||
def show
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
join_course_messages = CourseMessage.where("course_message_type =? and course_message_id =? and viewed =?", 'JoinCourseRequest', @user.id, false)
|
||||
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)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
|
||||
|
|
Loading…
Reference in New Issue