diff --git a/app/helpers/rooms_helper.rb b/app/helpers/rooms_helper.rb index c14b57eb..229577ca 100644 --- a/app/helpers/rooms_helper.rb +++ b/app/helpers/rooms_helper.rb @@ -59,4 +59,11 @@ module RoomsHelper def hidden_format_public ENV.fetch("HIDDEN_FORMATS_PUBLIC", "").split(",") end + + # Returns the total number of visibile rooms for the current user + def total_room_count(user) + total = user.rooms.length + total += user.shared_rooms.length if shared_access_allowed + total + end end diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index 0a8bb30e..0d8903df 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -82,7 +82,7 @@ - <% if current_user.ordered_rooms.length > 5 %> + <% if total_room_count(current_user) > 5 %>