From 20cbc0763cb76582253ef9cd5a5bcc72a1036b84 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 13 Jan 2017 15:14:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A6=82=E5=9B=BE?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E4=B8=AD=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A7=93=E5=90=8D=E6=98=BE=E7=A4=BA=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 5d90c461c..4453c2286 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -782,8 +782,8 @@ 您增加了新的班级成员:
  • - <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", - {:controller => 'courses', :action => 'settings', :id => ma.course_id, :tab=>'member'}, + <%= link_to User.find(ma.course_message_id).login + "(" + (User.find(ma.course_message_id).show_name) +")", + {:controller => 'courses', :action => 'settings', :id => ma.course_id, :tab => 'member'}, :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> From cd76f924058aa70f82fdd6d4f3921d4fb4c5b5d6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 13 Jan 2017 17:00:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8A=A0=E5=85=A5=E5=B0=8F=E9=93=83=E9=93=9B?= =?UTF-8?q?=EF=BC=9B=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 +++++-- app/helpers/users_helper.rb | 4 +++- app/models/blog_comment.rb | 1 + app/models/message.rb | 1 - app/models/user.rb | 3 ++- app/views/layouts/_logined_header.html.erb | 2 +- app/views/users/_user_message_applide_action.html.erb | 10 +++++----- app/views/users/_user_message_list.html.erb | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7b72d043c..5e8f3d5d6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -580,6 +580,8 @@ class UsersController < ApplicationController org_querys = OrgMessage.where("user_id=? and viewed=0", user) at_querys = AtMessage.where("user_id=? and viewed=0", user) contest_querys = ContestMessage.where(:user_id => user, :viewed => 0) + blog_querys = BlogMessage.where(:user_id => user, :viewed => 0) + applied_querys = AppliedMessage.where("user_id=? and viewed =?", user, 0) course_querys.update_all(:viewed => true) unless course_querys.nil? forge_querys.update_all(:viewed => true) unless forge_querys.nil? user_querys.update_all(:viewed => true) unless user_querys.nil? @@ -587,7 +589,8 @@ class UsersController < ApplicationController org_querys.update_all(:viewed => true) unless org_querys.nil? at_querys.update_all(:viewed => true) unless at_querys.nil? contest_querys.update_all(:viewed => true) unless contest_querys.nil? - + blog_querys.update_all(:viewed => true) unless blog_querys.nil? + applied_querys.update_all(:viewed => true) unless applied_querys.nil? end end @@ -2008,7 +2011,7 @@ class UsersController < ApplicationController def show if User.current == @user # 全部设为已读 - if params[:viewed] == "all" + if params[:viewed] == "set_viewed" update_message_viewed(@user) end # 自己的主页显示消息 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 7510af649..dcac601a4 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -308,7 +308,9 @@ module UsersHelper user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count at_count = user.at_messages.where(viewed: false).count contest_count = ContestMessage.where(:user_id => user, :viewed => 0).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count + contest_count + applied_count = AppliedMessage.where("user_id=? and viewed =?", user, 0).count + blog_count = BlogMessage.where(:user_id => user, :viewed => 0).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count + contest_count + blog_count + applied_count end def user_mail_notification_options(user) diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 6189d435f..cf241ce3b 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -6,6 +6,7 @@ class BlogComment < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :blog belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' + has_many :blog_messages, :class_name => 'BlogMessage', :as => :blog_message, :dependent => :destroy acts_as_tree :counter_cache => :comments_count, :order => "#{BlogComment.table_name}.sticky desc ,#{BlogComment.table_name}.created_on ASC" acts_as_attachable diff --git a/app/models/message.rb b/app/models/message.rb index 406ad067d..39902d757 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -48,7 +48,6 @@ class Message < ActiveRecord::Base has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy has_many :contest_messages, :class_name =>'ContestMessage', :as => :contest_message, :dependent => :destroy has_many :at_messages, as: :at_message, dependent: :destroy - has_many :blog_messages, :class_name => 'BlogMessage', :as => :blog_message, :dependent => :destroy has_many :ActivityNotifies,:as => :activity, :dependent => :destroy diff --git a/app/models/user.rb b/app/models/user.rb index 135ffb0f2..afc099d35 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -407,7 +407,8 @@ class User < Principal at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count - messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time).count + messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count end # 查询指派给我的缺陷记录 diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 293bb9131..330dd1cca 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -101,7 +101,7 @@ <% end %> <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
    - <%=render :partial => 'layouts/message_loading' %> + <%= render :partial => 'layouts/message_loading' %>
    diff --git a/app/views/users/_user_message_applide_action.html.erb b/app/views/users/_user_message_applide_action.html.erb index cfe01a092..21afe7122 100644 --- a/app/views/users/_user_message_applide_action.html.erb +++ b/app/views/users/_user_message_applide_action.html.erb @@ -5,29 +5,29 @@ <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue",:style => "font-size: 14px;" %> <% elsif ma.status == 2 %> - 已处理 + 已处理 <% elsif ma.status == 4 %> <% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.user_id).first %> <% operator = User.find(operator_message.applied_user_id).show_name %> - + <%= operator %>已拒绝 <% elsif ma.status == 5 %> <% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.applied_user_id).first %> <% operator = User.find(operator_message.applied_user_id).show_name %> - + <%= operator %>已拒绝 <% elsif ma.status == 6 %> <% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.user_id).first %> <% operator = User.find(operator_message.applied_user_id).show_name %> - + <%= operator %>已同意 <% elsif ma.status == 7 %> <% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.applied_user_id).first %> <% operator = User.find(operator_message.applied_user_id).show_name %> - + <%= operator %>已同意 <% end %> \ No newline at end of file diff --git a/app/views/users/_user_message_list.html.erb b/app/views/users/_user_message_list.html.erb index 9b99eb7f8..d71672257 100644 --- a/app/views/users/_user_message_list.html.erb +++ b/app/views/users/_user_message_list.html.erb @@ -5,7 +5,7 @@ <% count = unviewed_message(@user) %> <% unless (count == 0 || User.current != @user) %> - <%= link_to "全部设为已读", user_path(User.current, :viewed => 'all'), :class => "fl mr10" %> + <%= link_to "全部设为已读", user_path(User.current, :viewed => 'set_viewed'), :class => "fl mr10" %> <% end %> <%= @message_count %> 个消息 From 0cf17b999fd0b554ab21169951af711d98864037 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 13 Jan 2017 17:11:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8D=9A=E5=AE=A2?= =?UTF-8?q?=EF=BC=8C=E5=9B=9E=E5=A4=8D=E5=8D=9A=E5=AE=A2=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E8=B7=B3=E5=85=A5=E5=B8=A6id=E7=9A=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 2 +- app/views/users/reply_detail.js.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index cd01f31c5..4aaa64566 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -185,7 +185,7 @@ class BlogCommentsController < ApplicationController if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的 redirect_to syllabus_course_path(:id=>params[:course_id]) else - redirect_to user_blog_blog_comment_path(:user_id => @article.author_id, :blog_id => @article.blog_id, :id => @article) + redirect_to user_blog_blog_comment_path( @article.author, :blog_id => @article.blog_id, :id => @article) end } diff --git a/app/views/users/reply_detail.js.erb b/app/views/users/reply_detail.js.erb index fe51a4b29..91828ef0f 100644 --- a/app/views/users/reply_detail.js.erb +++ b/app/views/users/reply_detail.js.erb @@ -18,7 +18,7 @@ <% if @user_activity_id.to_i != @root.id %> $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_blog_post_reply', :locals => {:activity => @root,:user_activity_id =>@user_activity_id}) %>"); <% else %> - window.location.href = "<%=user_blog_blog_comment_path(:user_id => @root.author_id,:blog_id=>@root.blog_id,:id=>@root.id) %>"; + window.location.href = "<%=user_blog_blog_comment_path(:user_id => @root.author,:blog_id => @root.blog_id,:id => @root.id) %>"; <% end %> <% elsif @type == 'News' || params[:type] == 'Comment' %> <% if @user_activity_id.to_i != @root.id %>