Skip to content

Commit

Permalink
removed a flaw where the user could view others tweets
Browse files Browse the repository at this point in the history
  • Loading branch information
varshajayadev committed May 12, 2015
1 parent 9b23005 commit d562d48
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,17 @@ def older_result_detail(request, id):
def older_result_detail_with_hash(request, result_id):
try:
analysis_result = HashTagAnalysisResult.objects.get(pk=result_id)
positive_tweets = analysis_result.positive_tweets.all()
negative_tweets = analysis_result.negative_tweets.all()

return render_to_response("detailed_analysis_with_tweets.html",
{
'result': analysis_result,
'positive_tweets': positive_tweets,
'negative_tweets': negative_tweets
})
if request.user == analysis_result.analytics_request.user:
positive_tweets = analysis_result.positive_tweets.all()
negative_tweets = analysis_result.negative_tweets.all()

return render_to_response("detailed_analysis_with_tweets.html",
{
'result': analysis_result,
'positive_tweets': positive_tweets,
'negative_tweets': negative_tweets
})
return HttpResponseBadRequest()
except ObjectDoesNotExist:
return HttpResponseNotFound()

Expand Down

0 comments on commit d562d48

Please sign in to comment.