From 5ebfbc901ac125a2f12565cce192aa57c6778275 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 8 Jan 2016 09:41:12 +0800 Subject: [PATCH] =?UTF-8?q?at=E6=8E=92=E5=BA=8F=E6=8C=89=E7=85=A7=E6=8B=BC?= =?UTF-8?q?=E9=9F=B3=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 8c551d0df..9e7309646 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -7,10 +7,14 @@ class AtController < ApplicationController @logger = Logger.new(Rails.root.join('log', 'at.log').to_s) users = find_at_users(params[:type], params[:id]) @users = users - @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id } if users + @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users end private + def to_pinyin(s) + Pinyin.t(s).downcase + end + def find_at_users(type, id) @logger.info("#{type}, #{id}") case type