app/controllers/thredded/moderation_controller.rb in thredded-0.15.5 vs app/controllers/thredded/moderation_controller.rb in thredded-0.16.0

- old
+ new

@@ -52,11 +52,16 @@ redirect_back fallback_location: pending_moderation_path end def users @users = Thredded.user_class - .left_join_thredded_user_details - .merge(Thredded::UserDetail.order(moderation_state_changed_at: :desc)) + .eager_load(:thredded_user_detail) + .merge( + Thredded::UserDetail.order( + Arel.sql('COALESCE(thredded_user_details.moderation_state, 0) ASC,'\ + 'thredded_user_details.moderation_state_changed_at DESC') + ) + ) @query = params[:q].to_s @users = DbTextSearch::CaseInsensitive.new(@users, Thredded.user_name_column).prefix(@query) if @query.present? @users = @users.page(current_page) end