<commit_before>angular
	.module('Whatsapp')
	.controller('ProfileCtrl', ProfileCtrl);

//

function ProfileCtrl ($scope, $reactive, $state, $ionicPopup, $log){
	$reactive(this).attach($scope);

	let user = Meteor.user();
	let name = user && user.profile ? user.profile.name : '';

	this.name = name;
	this.updateName = updateName;

	////

	function updateName () {
		if (._isEmpty(this.name)) return;

		Meteor.call('updateName', this.name, (err) => {
			if (err) return handleError(err);
			$state.go('tab.chats');
		});
	}

	function handleError(err){
		$log.error('profile save error', err);

		$ionicPopup.alert({
			title: err.reason || 'Save failed', 
			template: 'Please try again',<commit_msg>Bug Fix: fixed profile controller<commit_after>angular
	.module('Whatsapp')
	.controller('ProfileCtrl', ProfileCtrl);

//

function ProfileCtrl ($scope, $reactive, $state, $ionicPopup, $log){
	$reactive(this).attach($scope);

	let user = Meteor.user();
	let name = user && user.profile ? user.profile.name : '';

	this.name = name;
	this.updateName = updateName;

	////

  function updateName () {
    if (_.isEmpty(this.name)) return;
 
    Meteor.call('updateName', this.name, (err) => {
      if (err) return handleError(err);
      $state.go('tab.chats');
    });
  }

	function handleError(err){
		$log.error('profile save error', err);

		$ionicPopup.alert({
			title: err.reason || 'Save failed', 
			template: 'Please try again',
{'fraction_non_alphanumeric': 0.17859624739402363, 'fraction_numerical': 0.0, 'mean_word_length': 3.9655172413793105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '247012', 'n_tokens_mistral': 519, 'n_tokens_neox': 475, 'n_words': 107}