forgeplus/app/controllers/users/recent_contacts_controller.rb

9 lines
388 B
Ruby
Raw Normal View History

2020-03-09 00:40:16 +08:00
class Users::RecentContactsController < Users::BaseController
before_action :private_user_resources!
def index
contacts = observed_user.recent_contacts.distinct
contacts = contacts.where(laboratory_id: current_laboratory.id) unless current_laboratory.main_site?
@contacts = contacts.order('private_messages.created_at DESC').limit(10).includes(:user_extension)
end
end