| @@ 35-43 (lines=9) @@ | ||
| 32 | Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i |
|
| 33 | end |
|
| 34 | ||
| 35 | def room_limit_exceeded |
|
| 36 | limit = Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i |
|
| 37 | ||
| 38 | # Does not apply to admin or users that aren't signed in |
|
| 39 | # 15+ option is used as unlimited |
|
| 40 | return false if current_user&.has_cached_role?(:admin) || limit == 15 |
|
| 41 | ||
| 42 | current_user.rooms.length >= limit |
|
| 43 | end |
|
| 44 | ||
| 45 | def current_room_exceeds_limit(room) |
|
| 46 | # Get how many rooms need to be deleted to reach allowed room number |
|
| @@ 287-295 (lines=9) @@ | ||
| 284 | current_user.nil? |
|
| 285 | end |
|
| 286 | ||
| 287 | def room_limit_exceeded |
|
| 288 | limit = Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i |
|
| 289 | ||
| 290 | # Does not apply to admin |
|
| 291 | # 15+ option is used as unlimited |
|
| 292 | return false if current_user&.has_cached_role?(:admin) || limit == 15 |
|
| 293 | ||
| 294 | current_user.rooms.count >= limit |
|
| 295 | end |
|
| 296 | ||
| 297 | def join_room(opts) |
|
| 298 | room_settings = JSON.parse(@room[:room_settings]) |
|