diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..58b3e12d6 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,5 @@ +module UsersHelper + def prepend_current_user_to(users_scope) + users_scope.to_a.prepend(Current.user).uniq + end +end diff --git a/app/models/user.rb b/app/models/user.rb index b4d36c032..5b5137ae1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,7 +18,6 @@ class User < ApplicationRecord normalizes :email_address, with: ->(value) { value.strip.downcase } scope :alphabetically, -> { order("lower(name)") } - scope :sorted_with_user_first, ->(user) { order(Arel.sql("users.id != ?, lower(name)", user.id)) } def initials name.to_s.scan(/\b\p{L}/).join.upcase diff --git a/app/views/bubbles/_messages.html.erb b/app/views/bubbles/_messages.html.erb index 3bc0610d0..85ea86c05 100644 --- a/app/views/bubbles/_messages.html.erb +++ b/app/views/bubbles/_messages.html.erb @@ -12,7 +12,7 @@