forked from External/greenlight
Added fix for room limit (#618)
This commit is contained in:
parent
338953d728
commit
f1b4089d15
|
@ -37,7 +37,7 @@ module RoomsHelper
|
||||||
|
|
||||||
# Does not apply to admin or users that aren't signed in
|
# Does not apply to admin or users that aren't signed in
|
||||||
# 15+ option is used as unlimited
|
# 15+ option is used as unlimited
|
||||||
return false if !current_user || current_user&.has_role?(:admin) || limit == 15
|
return false if current_user&.has_role?(:admin) || limit == 15
|
||||||
|
|
||||||
current_user.rooms.length >= limit
|
current_user.rooms.length >= limit
|
||||||
end
|
end
|
||||||
|
@ -45,8 +45,10 @@ module RoomsHelper
|
||||||
def current_room_exceeds_limit(room)
|
def current_room_exceeds_limit(room)
|
||||||
# Get how many rooms need to be deleted to reach allowed room number
|
# Get how many rooms need to be deleted to reach allowed room number
|
||||||
limit = Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i
|
limit = Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i
|
||||||
@diff = current_user.rooms.count - limit
|
|
||||||
|
|
||||||
|
return false if current_user&.has_role?(:admin) || limit == 15
|
||||||
|
|
||||||
|
@diff = current_user.rooms.count - limit
|
||||||
@diff.positive? && current_user.rooms.pluck(:id).index(room.id) + 1 > limit
|
@diff.positive? && current_user.rooms.pluck(:id).index(room.id) + 1 > limit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue