Commit afeb5522189dd43661a9c1ec5921bd4d427d7f40
1 parent
9cd1cb08
Remove user from search
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/controllers/public/search_controller.rb
@@ -154,7 +154,7 @@ class SearchController < PublicController | @@ -154,7 +154,7 @@ class SearchController < PublicController | ||
154 | render :text => find_suggestions(normalize_term(params[:term]), environment, params[:asset]).to_json | 154 | render :text => find_suggestions(normalize_term(params[:term]), environment, params[:asset]).to_json |
155 | end | 155 | end |
156 | 156 | ||
157 | - def search_for_users | 157 | + def search_for_friends_and_members |
158 | # If it isn't a ajax call give to the user an access denied response | 158 | # If it isn't a ajax call give to the user an access denied response |
159 | return render_access_denied unless request.xhr? | 159 | return render_access_denied unless request.xhr? |
160 | 160 | ||
@@ -166,7 +166,7 @@ class SearchController < PublicController | @@ -166,7 +166,7 @@ class SearchController < PublicController | ||
166 | )[:results] | 166 | )[:results] |
167 | 167 | ||
168 | if params[:community].present? and (community = Community.find_by_identifier params[:community]) | 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 | results += find_by_contents( | 170 | results += find_by_contents( |
171 | :people, environment, scope, | 171 | :people, environment, scope, |
172 | params['q'], {:page => 1} | 172 | params['q'], {:page => 1} |
public/javascripts/user-mention.js
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | 9 | ||
10 | $('#comment_body, #leave_scrap_content, form.profile-wall-reply-form textarea').mentionsInput({ | 10 | $('#comment_body, #leave_scrap_content, form.profile-wall-reply-form textarea').mentionsInput({ |
11 | onDataRequest: function (mode, keyword, onDataRequestCompleteCallback) { | 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 | $.ajax({ | 14 | $.ajax({ |
15 | method: "GET", | 15 | method: "GET", |