<commit_before>define [
	"base"
], (App) ->
	App.controller "HistoryDiffController", ($scope, $modal, ide, event_tracking) ->
		$scope.restoreDeletedDoc = () ->
			event_tracking.sendMB "history-restore-deleted"
			$scope.history.diff.restoreInProgress = true
			ide.historyManager
				.restoreDeletedDoc(
					$scope.history.diff.doc
				)
				.then (response) ->
					$scope.history.diff.restoredDocNewId = response.doc_id
					$scope.history.diff.restoreInProgress = false
					$scope.history.diff.restoreDeletedSuccess = true

		$scope.openRestoreDiffModal = () ->
			event_tracking.sendMB "history-restore-modal"
			$modal.open {
				templateUrl: "historyRestoreDiffModalTemplate"
				controller: "HistoryRestoreDiffModalController"
				resolve:
					diff: () -> $scope.history.diff
			}

		$scope.backToEditorAfterRestore = () -><commit_msg>Correctly access response parameters.<commit_after>define [
	"base"
], (App) ->
	App.controller "HistoryDiffController", ($scope, $modal, ide, event_tracking) ->
		$scope.restoreDeletedDoc = () ->
			event_tracking.sendMB "history-restore-deleted"
			$scope.history.diff.restoreInProgress = true
			ide.historyManager
				.restoreDeletedDoc(
					$scope.history.diff.doc
				)
				.then (response) ->
					{ data } = response
					$scope.history.diff.restoredDocNewId = data.doc_id
					$scope.history.diff.restoreInProgress = false
					$scope.history.diff.restoreDeletedSuccess = true

		$scope.openRestoreDiffModal = () ->
			event_tracking.sendMB "history-restore-modal"
			$modal.open {
				templateUrl: "historyRestoreDiffModalTemplate"
				controller: "HistoryRestoreDiffModalController"
				resolve:
					diff: () -> $scope.history.diff
			}

		$scope.backToEditorAfterRestore = () ->
{'fraction_non_alphanumeric': 0.1276595744680851, 'fraction_numerical': 0.0, 'mean_word_length': 3.767123287671233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5047035', 'n_tokens_mistral': 651, 'n_tokens_neox': 537, 'n_words': 79}