BigW Consortium Gitlab

Commit 8b68142a by Alfredo Sumaran

Prevent creating autocomplete dropdown is user is not logged in

parent 180da813
...@@ -32,7 +32,8 @@ class @SearchAutocomplete ...@@ -32,7 +32,8 @@ class @SearchAutocomplete
@saveOriginalState() @saveOriginalState()
@createAutocomplete() # Only when user is logged in
@createAutocomplete() if gon.current_user_id
@searchInput.addClass('disabled') @searchInput.addClass('disabled')
...@@ -123,6 +124,9 @@ class @SearchAutocomplete ...@@ -123,6 +124,9 @@ class @SearchAutocomplete
@clearInput.on 'click', @onRemoveLocationClick @clearInput.on 'click', @onRemoveLocationClick
enableAutocomplete: -> enableAutocomplete: ->
# No need to enable anything if user is not logged in
return if !gon.current_user_id
dropdownMenu = @dropdown.find('.dropdown-menu') dropdownMenu = @dropdown.find('.dropdown-menu')
_this = @ _this = @
@loadingSuggestions = false @loadingSuggestions = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment