<commit_before>angular.module('zeus.editReview', [])
.controller('editReviewController', function($location, $stateParams, Details) {
  var EditReviewVm = this;
  var id = $stateParams.id;
  var currentUser = JSON.parse(localStorage.getItem('profile'));
  EditReviewVm.title = '';
  EditReviewVm.content = '';
  EditReviewVm.rating = '';

  Details.getReviewById(id)
    .then(function(reviewInfo){
      console.log(currentUser)
      if(currentUser === null || currentUser.user_id !== reviewInfo.review.user_id){
        return EditReviewVm.cancel();
      }

      EditReviewVm.title = reviewInfo.review.title;
      EditReviewVm.content = reviewInfo.review.content;
      EditReviewVm.rating = reviewInfo.review.rating;
    });

  EditReviewVm.edit = function(){
    var updatedReview = {
      content: EditReviewVm.content,
      title: EditReviewVm.title,
      rating: EditReviewVm.rating
    };
    Details.editReview(id, updatedReview)
    .then(function(){
      EditReviewVm.cancel();
    });
  };

  EditReviewVm.cancel = function(){
    $location.path('/review/' + id);
  };
});<commit_msg>Change functions removed from Details factory to run from new Reviews Factory<commit_after>angular.module('zeus.editReview', [])
.controller('editReviewController', function($location, $stateParams, Reviews) {
  var EditReviewVm = this;
  var id = $stateParams.id;
  var currentUser = JSON.parse(localStorage.getItem('profile'));
  EditReviewVm.title = '';
  EditReviewVm.content = '';
  EditReviewVm.rating = '';

  Reviews.getReviewById(id)
    .then(function(reviewInfo){
      console.log(currentUser);
      if(currentUser === null || currentUser.user_id !== reviewInfo.review.user_id){
        return EditReviewVm.cancel();
      }

      EditReviewVm.title = reviewInfo.review.title;
      EditReviewVm.content = reviewInfo.review.content;
      EditReviewVm.rating = reviewInfo.review.rating;
    });

  EditReviewVm.edit = function(){
    var updatedReview = {
      content: EditReviewVm.content,
      title: EditReviewVm.title,
      rating: EditReviewVm.rating
    };
    Reviews.editReview(id, updatedReview)
    .then(function(){
      EditReviewVm.cancel();
    });
  };

  EditReviewVm.cancel = function(){
    $location.path('/review/' + id);
  };
});
{'fraction_non_alphanumeric': 0.139463264408271, 'fraction_numerical': 0.0, 'mean_word_length': 3.6219512195121952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503263', 'n_tokens_mistral': 700, 'n_tokens_neox': 695, 'n_words': 111}