Commit afeb5522189dd43661a9c1ec5921bd4d427d7f40

Authored by Fabio Teixeira
1 parent 9cd1cb08

Remove user from search

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
app/controllers/public/search_controller.rb
... ... @@ -154,7 +154,7 @@ class SearchController &lt; PublicController
154 154 render :text => find_suggestions(normalize_term(params[:term]), environment, params[:asset]).to_json
155 155 end
156 156  
157   - def search_for_users
  157 + def search_for_friends_and_members
158 158 # If it isn't a ajax call give to the user an access denied response
159 159 return render_access_denied unless request.xhr?
160 160  
... ... @@ -166,7 +166,7 @@ class SearchController &lt; PublicController
166 166 )[:results]
167 167  
168 168 if params[:community].present? and (community = Community.find_by_identifier params[:community])
169   - scope = community.members # .select(:id, :name, :identifier) is not working here
  169 + scope = community.members.where.not(id: user.id) # .select(:id, :name, :identifier) is not working here
170 170 results += find_by_contents(
171 171 :people, environment, scope,
172 172 params['q'], {:page => 1}
... ...
public/javascripts/user-mention.js
... ... @@ -9,7 +9,7 @@
9 9  
10 10 $('#comment_body, #leave_scrap_content, form.profile-wall-reply-form textarea').mentionsInput({
11 11 onDataRequest: function (mode, keyword, onDataRequestCompleteCallback) {
12   - var search_url = "/search/search_for_users?q="+keyword;
  12 + var search_url = "/search/search_for_friends_and_members?q="+keyword;
13 13  
14 14 $.ajax({
15 15 method: "GET",
... ...