diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb index 7b1fa33f8..42291a407 100644 --- a/app/controllers/system_messages_controller.rb +++ b/app/controllers/system_messages_controller.rb @@ -42,7 +42,7 @@ class SystemMessagesController < ApplicationController @system_messages.user_id = User.current.id respond_to do |format| if @system_messages.save - format.html {redirect_to user_message_path(User.current, :type => "system_message")} + format.html {redirect_to user_message_path(User.current, :type => "system_messages")} flash[:notice] = l(:notice_successful_message) else if params[:system_message][:content].empty? diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 344bccc9c..487b68bd0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -117,7 +117,7 @@ class UsersController < ApplicationController message_last_time = message_new_time.onclick_time message_new_time.update_attributes(:onclick_time => Time.now) end - @user_system_messages = SystemMessage.where("created_at >?", message_last_time) + @user_system_messages = SystemMessage.where("created_at >?", message_last_time).order("created_at desc") # 当前用户查看消息,则设置消息为已读 if params[:viewed] == "all" course_querys = @user.course_messages @@ -148,7 +148,7 @@ class UsersController < ApplicationController @message_alls << message_all.message end end - when 'system_message' + when 'system_messages' @message_alls = SystemMessage.order("created_at desc").all when 'apply' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc") diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 1ae6fbfb6..15eebc15e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -60,7 +60,7 @@ module UsersHelper '未读消息' when 'apply' '用户申请' - when 'system_message' + when 'system_messages' '系统消息' when 'homework' '作业消息' diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 26b606f49..a9fb0ffbd 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -25,7 +25,7 @@ <%# 系统贴吧 %>