<commit_before>import {Component, OnInit} from '@angular/core';
import {
    NgForm,
    FormControl,
    FormGroup,
    Validators,
    ValidatorFn,
    AbstractControl,
    REACTIVE_FORM_DIRECTIVES
}    from '@angular/forms';
import {Http} from '@angular/http';
import {Headers, RequestOptions} from '@angular/http';
import {User} from '../../../components/User';
import {ROUTER_DIRECTIVES, Router, ActivatedRoute} from '@angular/router';
import {AuthHttp} from 'angular2-jwt';

@Component({
    selector: 'user-message',
    templateUrl: './routes/user/message/user.message.html',
    directives: [ROUTER_DIRECTIVES, REACTIVE_FORM_DIRECTIVES],
    providers: []
})

export class UserMessageComponent implements OnInit {
    form:FormGroup;

    model:{
        username?:string,
        subject?:string,
        message?:string
    };

    constructor(private router:Router,
                private route:ActivatedRoute,
                public http:Http,
                public authHttp:AuthHttp) {

        this.form = new FormGroup({
            required: new FormControl("", Validators.required)
        });

        this.model = {};
    }

    user = new User();
    body:{
        username?:string
    };

    ngOnInit() {
        this.body = {};

        this.route
            .params
            .subscribe(
                params => {
                    this.body.username = params['username'];
                }
            );

        let headers = new Headers({'Content-Type': 'application/json'});
        let options = new RequestOptions({headers: headers});

        this.authHttp.post('/api/user/get',
            JSON.stringify(this.body),
            options)
            .map(res => res.json())
            .subscribe(
                data => this.user = data,
                error => console.log(error)
            );
    }

    onSubmit() {
        this.route
            .params
            .subscribe(
                params => {
                    this.model.username = params['username'];
                }
            );

        let headers = new Headers({'Content-Type': 'application/json'});
        let options = new RequestOptions({headers: headers});

        this.authHttp.post('/api/user/send/mail', JSON.stringify(this.model), options)
            .map(res => {
                let body = res.json();
                return body
            })
            .subscribe(
                data => {
                    this.router.navigate(['/single', this.model.username]);
                },
                error => console.log(error)
            );
    }<commit_msg>proper router.navigate url in userMessage.component<commit_after>import {Component, OnInit} from '@angular/core';
import {
    NgForm,
    FormControl,
    FormGroup,
    Validators,
    ValidatorFn,
    AbstractControl,
    REACTIVE_FORM_DIRECTIVES
}    from '@angular/forms';
import {Http} from '@angular/http';
import {Headers, RequestOptions} from '@angular/http';
import {User} from '../../../components/User';
import {ROUTER_DIRECTIVES, Router, ActivatedRoute} from '@angular/router';
import {AuthHttp} from 'angular2-jwt';

@Component({
    selector: 'user-message',
    templateUrl: './routes/user/message/user.message.html',
    directives: [ROUTER_DIRECTIVES, REACTIVE_FORM_DIRECTIVES],
    providers: []
})

export class UserMessageComponent implements OnInit {
    form:FormGroup;

    model:{
        username?:string,
        subject?:string,
        message?:string
    };

    constructor(private router:Router,
                private route:ActivatedRoute,
                public http:Http,
                public authHttp:AuthHttp) {

        this.form = new FormGroup({
            required: new FormControl("", Validators.required)
        });

        this.model = {};
    }

    user = new User();
    body:{
        username?:string
    };

    ngOnInit() {
        this.body = {};

        this.route
            .params
            .subscribe(
                params => {
                    this.body.username = params['username'];
                }
            );

        let headers = new Headers({'Content-Type': 'application/json'});
        let options = new RequestOptions({headers: headers});

        this.authHttp.post('/api/user/get',
            JSON.stringify(this.body),
            options)
            .map(res => res.json())
            .subscribe(
                data => this.user = data,
                error => console.log(error)
            );
    }

    onSubmit() {
        this.route
            .params
            .subscribe(
                params => {
                    this.model.username = params['username'];
                }
            );

        let headers = new Headers({'Content-Type': 'application/json'});
        let options = new RequestOptions({headers: headers});

        this.authHttp.post('/api/user/send/mail', JSON.stringify(this.model), options)
            .map(res => {
                let body = res.json();
                return body
            })
            .subscribe(
                data => {
                    this.router.navigate(['/developer', this.model.username]);
                },
                error => console.log(error)
            );
    }
{'fraction_non_alphanumeric': 0.12754616409670663, 'fraction_numerical': 0.0003807348181991243, 'mean_word_length': 1.6985105290190037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '5040648', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1365, 'n_words': 282}