forked from External/greenlight
Fixed issue with rooms not correctly ordering (#963)
This commit is contained in:
@ -103,6 +103,11 @@ class User < ApplicationRecord
|
||||
order(Arel.sql("#{column} #{direction}"))
|
||||
end
|
||||
|
||||
# Returns a list of rooms ordered by last session
|
||||
def ordered_rooms
|
||||
[main_room] + rooms.where.not(id: main_room.id).order("last_session desc")
|
||||
end
|
||||
|
||||
# Activates an account and initialize a users main room
|
||||
def activate
|
||||
update_attributes(email_verified: true, activated_at: Time.zone.now)
|
||||
|
@ -77,7 +77,7 @@
|
||||
</div>
|
||||
|
||||
<div id="room_block_container" class="row pt-7 pb-5">
|
||||
<% current_user.rooms.each do |room| %>
|
||||
<% current_user.ordered_rooms.each do |room| %>
|
||||
<div class="col-lg-4 col-md-6 col-sm-12">
|
||||
<%= link_to room do %>
|
||||
<%= render "rooms/components/room_block", room: room %>
|
||||
|
Reference in New Issue
Block a user