如图竞赛类消息不管是已读或未读,始终是加粗的
This commit is contained in:
parent
6d84085d61
commit
a01d0d75e7
|
@ -474,8 +474,10 @@ class ApplicationController < ActionController::Base
|
|||
render_404 unless @object.present?
|
||||
|
||||
@project = @object.project
|
||||
if @project == nil && @object.has_attribute?('course_id')
|
||||
if @project == nil && !@object.course_id.nil?
|
||||
@course = @object.course
|
||||
else
|
||||
@contest = @object.contest
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -113,6 +113,8 @@ class BoardsController < ApplicationController
|
|||
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
|
||||
elsif @course
|
||||
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
|
||||
elsif @contest
|
||||
ContestMessage.where("user_id =? and contest_id =? and viewed =?", User.current.id, @contest.id, 0).update_all(:viewed => true)
|
||||
end
|
||||
|
||||
# sort_init 'updated_on', 'desc'
|
||||
|
|
|
@ -17,6 +17,9 @@ class ContestsController < ApplicationController
|
|||
layout "base_contests"
|
||||
|
||||
def show
|
||||
#更新创建课程消息状态
|
||||
contest_request_messages = ContestMessage.where("user_id = #{User.current.id} and contest_id = #{@contest.id} and contest_message_type in ('ContestRequestDealResult', 'JoinContest', 'RemoveFromContest') and viewed = 0")
|
||||
contest_request_messages.update_all(:viewed => true)
|
||||
@left_nav_type = 1
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -26,10 +29,6 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
|
||||
def contest_activities
|
||||
#更新创建课程消息状态
|
||||
contest_request_messages = ContestMessage.where(:user_id => User.current.id, :contest_id => @contest.id, :contest_message_type => "ContestRequestDealResult", :viewed => false)
|
||||
contest_request_messages.update_all(:viewed => true)
|
||||
|
||||
contest_activities = @contest.contest_activities
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
if params[:type].present?
|
||||
|
|
|
@ -240,10 +240,13 @@ class NewsController < ApplicationController
|
|||
# 更新新闻
|
||||
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
# 更新新闻的时候一并更新回复
|
||||
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
else
|
||||
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
elsif @course
|
||||
query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
elsif @contest
|
||||
query_message_news = ContestMessage.where("contest_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
ContestMessage.where("contest_message_id in (#{ids}) and contest_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
end
|
||||
query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
|
||||
# over
|
||||
|
|
Loading…
Reference in New Issue