commit
2e137ea5b7
|
@ -75,6 +75,10 @@ class AvatarController < ApplicationController
|
|||
end
|
||||
@temp_file = nil
|
||||
|
||||
while !File.exist?(diskfile)
|
||||
sleep(0.5)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.json{
|
||||
render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'
|
||||
|
|
|
@ -58,7 +58,7 @@ class MessagesController < ApplicationController
|
|||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
if @course
|
||||
#帖子消息状态更新
|
||||
course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Message', @course.id, 0)
|
||||
course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_message_id =? and course_id =? and viewed =?", User.current.id, 'Message', @topic.id, @course.id, 0)
|
||||
course_messages.update_all(:viewed => true)
|
||||
#@replies = @topic.children.
|
||||
#includes(:author, :attachments, :praise_tread_cache, {:board => :project}).
|
||||
|
@ -67,10 +67,10 @@ class MessagesController < ApplicationController
|
|||
#offset(@reply_pages.offset).
|
||||
#all
|
||||
#@replies = paginateHelper messages_replies,10
|
||||
# 班级帖子消息设为已读
|
||||
# 班级帖子回复消息设为已读
|
||||
@replies.each do |comment|
|
||||
course_message = CourseMessage.where(:course_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
|
||||
course_message.update_all(:viewed => 1)
|
||||
course_message = CourseMessage.where(:course_message_type => 'Message', :course_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
|
||||
course_message.update_all(:viewed => 1)
|
||||
end
|
||||
@left_nav_type = 2
|
||||
respond_to do |format|
|
||||
|
@ -80,7 +80,7 @@ class MessagesController < ApplicationController
|
|||
#render :action => "show", :layout => "base_courses"#by young
|
||||
elsif @project
|
||||
#帖子消息状态更新
|
||||
project_messages = ForgeMessage.where("user_id =? and forge_message_type =? and project_id =? and viewed =?", User.current.id, 'Message', @project.id, 0)
|
||||
project_messages = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id =? and project_id =? and viewed =?", User.current.id, 'Message', @topic.id, @project.id, 0)
|
||||
project_messages.update_all(:viewed => true)
|
||||
#@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
# @replies = @topic.children.
|
||||
|
@ -89,14 +89,25 @@ class MessagesController < ApplicationController
|
|||
# limit(@reply_pages.per_page).
|
||||
# offset(@reply_pages.offset).
|
||||
# all
|
||||
# 项目帖子回复消息设为已读
|
||||
@replies.each do |comment|
|
||||
project_message = ForgeMessage.where(:forge_message_type => 'Message', :forge_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
|
||||
project_message.update_all(:viewed => 1)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_projects'}
|
||||
end
|
||||
elsif @contest
|
||||
#帖子消息状态更新
|
||||
contest_messages = ContestMessage.where("user_id =? and contest_message_type =? and contest_id =? and viewed =?", User.current.id, 'Message', @contest.id, 0)
|
||||
contest_messages = ContestMessage.where("user_id =? and contest_message_type =? and contest_message_id =? and contest_id =? and viewed =?", User.current.id, 'Message', @topic.id, @contest.id, 0)
|
||||
contest_messages.update_all(:viewed => true)
|
||||
|
||||
# 竞赛帖子回复消息设为已读
|
||||
@replies.each do |comment|
|
||||
contest_message = ContestMessage.where(:contest_message_type => 'Message', :contest_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
|
||||
contest_message.update_all(:viewed => 1)
|
||||
end
|
||||
@left_nav_type = 4
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
Loading…
Reference in New Issue