DEV: Add secondary sort to `Group.visible_groups` (#17659)
Fix a flaky group controller spec and makes the API responses more stable.
This commit is contained in:
parent
23a267c75d
commit
0d3cf3333a
|
@ -150,7 +150,9 @@ class Group < ActiveRecord::Base
|
|||
scope :with_smtp_configured, -> { where(smtp_enabled: true) }
|
||||
|
||||
scope :visible_groups, Proc.new { |user, order, opts|
|
||||
groups = self.order(order || "groups.name ASC")
|
||||
groups = self
|
||||
groups = groups.order(order) if order
|
||||
groups = groups.order("groups.name ASC") unless order&.include?("name")
|
||||
|
||||
if !opts || !opts[:include_everyone]
|
||||
groups = groups.where("groups.id > 0")
|
||||
|
|
Loading…
Reference in New Issue