diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index babbceb460..331a5ca5f7 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -1822,7 +1822,8 @@ class ActivityTable(object): row['age'] = age def sorted_rows(self): - return sorted(self.rows.iteritems(), key=lambda (k,r): r['age']) + keyfunc = lambda (k,r): (r['realm'], -1 * r.get('send_message_count', 0)) + return sorted(self.rows.iteritems(), key=keyfunc) def can_view_activity(request): return request.user.realm.domain == 'zulip.com'