diff --git a/app/assets/javascripts/admin/components/ip-lookup.js.es6 b/app/assets/javascripts/admin/components/ip-lookup.js.es6 index d3140eecf..06a8387be 100644 --- a/app/assets/javascripts/admin/components/ip-lookup.js.es6 +++ b/app/assets/javascripts/admin/components/ip-lookup.js.es6 @@ -26,7 +26,8 @@ export default Ember.Component.extend({ this.set("otherAccountsLoading", true); Discourse.AdminUser.findAll("active", { "ip": this.get("ip"), - "exclude": this.get("user_id") + "exclude": this.get("user_id"), + "order": "trust_level DESC" }).then(function (users) { self.setProperties({ other_accounts: users, diff --git a/app/assets/javascripts/discourse/templates/components/ip-lookup.hbs b/app/assets/javascripts/discourse/templates/components/ip-lookup.hbs index 4afa200b1..6fd3bea83 100644 --- a/app/assets/javascripts/discourse/templates/components/ip-lookup.hbs +++ b/app/assets/javascripts/discourse/templates/components/ip-lookup.hbs @@ -5,6 +5,7 @@ {{/if}} {{#if show}}
+ {{fa-icon "times"}}

{{i18n ip_lookup.title}}

{{#if location}} @@ -40,21 +41,33 @@
{{#loading-spinner size="small" condition=otherAccountsLoading}} {{#if other_accounts}} -
    - {{#each other_accounts}} -
  • - {{#link-to "adminUser" this}}{{avatar this usernamePath="user.username" imageSize="small"}} {{username}}{{/link-to}} - ({{trustLevel.name}}), - {{i18n ip_lookup.read_time}} {{time_read}}, - {{i18n ip_lookup.topics_entered}} {{topics_entered}} -
  • - {{/each}} + + + + + + + + + + + + {{#each other_accounts}} + + + + + + + + {{/each}} + +
    {{i18n ip_lookup.username}}{{i18n ip_lookup.trust_level}}{{i18n ip_lookup.read_time}}{{i18n ip_lookup.topics_entered}}{{i18n ip_lookup.post_count}}
    {{#link-to "adminUser" this}}{{avatar this usernamePath="user.username" imageSize="small"}} {{username}}{{/link-to}}{{trustLevel.id}}{{time_read}}{{topics_entered}}{{post_count}}
    {{else}} {{i18n ip_lookup.no_other_accounts}} {{/if}} {{/loading-spinner}}
-
{{/if}} diff --git a/app/serializers/admin_user_serializer.rb b/app/serializers/admin_user_serializer.rb index 4c9f309ce..9d40ee61d 100644 --- a/app/serializers/admin_user_serializer.rb +++ b/app/serializers/admin_user_serializer.rb @@ -30,7 +30,7 @@ class AdminUserSerializer < BasicUserSerializer has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects - [:days_visited,:posts_read_count,:topics_entered].each do |sym| + [:days_visited, :posts_read_count, :topics_entered, :post_count].each do |sym| attributes sym define_method sym do object.user_stat.send(sym) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 5d7369364..16793af59 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -280,8 +280,11 @@ en: phone: Phone other_accounts: "Other accounts with this IP address:" no_other_accounts: (none) - read_time: "read time:" - topics_entered: "topics entered:" + username: "username" + trust_level: "TL" + read_time: "read time" + topics_entered: "topics entered" + post_count: "# posts" user: said: "{{username}}:" diff --git a/lib/admin_user_index_query.rb b/lib/admin_user_index_query.rb index cf20f2103..c0e11cdc7 100644 --- a/lib/admin_user_index_query.rb +++ b/lib/admin_user_index_query.rb @@ -10,11 +10,17 @@ class AdminUserIndexQuery attr_reader :params, :trust_levels def initialize_query_with_order(klass) + order = [params[:order]] + if params[:query] == "active" - klass.order("COALESCE(last_seen_at, to_date('1970-01-01', 'YYYY-MM-DD')) DESC, username") + order << "COALESCE(last_seen_at, to_date('1970-01-01', 'YYYY-MM-DD')) DESC" else - klass.order("created_at DESC, username") + order << "created_at DESC" end + + order << "username" + + klass.order(order.reject(&:blank?).join(",")) end def filter_by_trust