博客回复发送的消息,点击之后没有自动更新为已读

This commit is contained in:
daiao 2017-02-16 15:18:35 +08:00
parent 0d1738cf91
commit cb5548c853
2 changed files with 8 additions and 0 deletions

View File

@ -39,6 +39,9 @@ class BlogCommentsController < ApplicationController
end
end
def show
# 更新博客消息为已读
update_messsages_to_viewed("BlogMessage", params[:blog_id])
@article = BlogComment.find(params[:id])
@replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc")
@reply_count = @replies.count

View File

@ -1053,6 +1053,11 @@ module ApplicationHelper
:user_id => User.current,
:contest_id => forge_message_id,
:viewed => false)
elsif(message_type == "BlogMessage")
query = BlogMessage.where(:blog_message_type => "BlogComment",
:user_id => User.current,
:blog_id => forge_message_id,
:viewed => false)
end
query.update_all(:viewed => true) unless query.blank?
end