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