-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5823 – Prevent an attempted relationship between items across teams #2149
Conversation
a167c7a
to
46534fb
Compare
we should add tests in the smooch level
…com:meedan/check-api into 5676-alegre-bot-must-filter-invalid-results
86c7659
to
dba3e81
Compare
app/models/concerns/alegre_v2.rb
Outdated
def isolate_relevant_context(project_media, result) | ||
(result["contexts"]||result["context"]).select{|x| ([x["team_id"]].flatten & [project_media.team_id].flatten).count > 0 && !x["temporary_media"]}.first | ||
def isolate_relevant_context(team_id, result) | ||
(result["contexts"]||result["context"]).select{|x| ([x["team_id"]].flatten & [team_id].flatten).count > 0 && !x["temporary_media"]}.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably needs to be [(result["contexts"]||result["context"])].flatten.select....
instead here
response = Bot::Alegre.query_sync_with_params(params, "text") | ||
results = response['result'].to_a.sort_by{ |result| result['_score'] } | ||
response = Bot::Alegre.query_sync_with_params(params, "text")["result"].collect{|result| | ||
result["context"] = Bot::Alegre.isolate_relevant_context(team_id, result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reasons I don't understand, Explainers appear to be indexed in Alegre with the team slug rather than the team_id. As a result, this won't work.
I think the correction action is to index explainers with team_id
, but whatever the solution we need to work that out first.
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context – why has this been changed/fixed.
References: CV2-5676, CV2-5823
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can verify the changes. Please describe whether or not you implemented automated tests.
Things to pay attention to during code review
Please describe parts of the change that require extra attention during code review, for example:
Checklist